Fix stratagus-maemo-extract.h - ignore '\n' in version string
This commit is contained in:
parent
f1f5559d1b
commit
e1c8c27bbb
1 changed files with 32 additions and 8 deletions
|
@ -194,24 +194,48 @@ int main(int argc, char * argv[]) {
|
||||||
if ( file ) {
|
if ( file ) {
|
||||||
|
|
||||||
char act_version[20];
|
char act_version[20];
|
||||||
fgets(act_version, 20, file);
|
int have_version = 0;
|
||||||
|
|
||||||
|
if ( fgets(act_version, 20, file) )
|
||||||
|
have_version = 1;
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
|
|
||||||
|
if ( have_version ) {
|
||||||
|
|
||||||
file = popen(EXTRACT_BIN " -V", "r");
|
file = popen(EXTRACT_BIN " -V", "r");
|
||||||
|
|
||||||
if ( file ) {
|
if ( file ) {
|
||||||
|
|
||||||
|
int i;
|
||||||
char new_version[20];
|
char new_version[20];
|
||||||
fgets(new_version, 20, file);
|
have_version = 0;
|
||||||
|
|
||||||
|
if ( fgets(new_version, 20, file) )
|
||||||
|
have_version = 1;
|
||||||
|
|
||||||
pclose(file);
|
pclose(file);
|
||||||
|
|
||||||
if ( strncmp(act_version, new_version, 19) == 0 )
|
if ( have_version ) {
|
||||||
|
|
||||||
|
for ( i = 0; i < 20; ++i ) {
|
||||||
|
if ( new_version[i] == '\n' ) {
|
||||||
|
new_version[i] = 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( strcmp(act_version, new_version) == 0 )
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
message(GAME_NAME, DATA_NEED_COPY, 0);
|
message(GAME_NAME, DATA_NEED_COPY, 0);
|
||||||
|
|
||||||
if ( stat(DATA_DIR "/" GAME_CD_FILE, &st) != 0 ) {
|
if ( stat(DATA_DIR "/" GAME_CD_FILE, &st) != 0 ) {
|
||||||
|
|
Loading…
Reference in a new issue