version 1.1.1.2, 2013/07/22 00:36:10
|
version 1.1.1.3, 2023/09/27 11:21:37
|
Line 1
|
Line 1
|
/* $Id$ */ |
/* $Id$ */ |
/* Project: miniupnp |
/* Project: miniupnp |
* http://miniupnp.free.fr/ or http://miniupnp.tuxfamily.org/ | * http://miniupnp.free.fr/ or https://miniupnp.tuxfamily.org/ |
* Author: Thomas Bernard |
* Author: Thomas Bernard |
* Copyright (c) 2005-2009 Thomas Bernard | * Copyright (c) 2005-2021 Thomas Bernard |
* This software is subjects to the conditions detailed |
* This software is subjects to the conditions detailed |
* in the LICENSE file provided within this distribution */ |
* in the LICENSE file provided within this distribution */ |
#include <stdio.h> |
#include <stdio.h> |
Line 44 int main(int argc, char * * argv) {
|
Line 44 int main(int argc, char * * argv) {
|
fin = fopen("VERSION", "r"); |
fin = fopen("VERSION", "r"); |
fgets(miniupnpcVersion, sizeof(miniupnpcVersion), fin); |
fgets(miniupnpcVersion, sizeof(miniupnpcVersion), fin); |
fclose(fin); |
fclose(fin); |
for(n = 0; n < sizeof(miniupnpcVersion); n++) { | for(n = 0; n < (int)sizeof(miniupnpcVersion); n++) { |
if(miniupnpcVersion[n] < ' ') |
if(miniupnpcVersion[n] < ' ') |
miniupnpcVersion[n] = '\0'; |
miniupnpcVersion[n] = '\0'; |
} |
} |
Line 59 int main(int argc, char * * argv) {
|
Line 59 int main(int argc, char * * argv) {
|
fout = fopen(argv[2], "w"); |
fout = fopen(argv[2], "w"); |
if(!fout) { |
if(!fout) { |
fprintf(stderr, "Cannot open %s for writing.\n", argv[2]); |
fprintf(stderr, "Cannot open %s for writing.\n", argv[2]); |
|
fclose(fin); |
return 1; |
return 1; |
} |
} |
n = 0; |
n = 0; |
Line 77 int main(int argc, char * * argv) {
|
Line 78 int main(int argc, char * * argv) {
|
fclose(fin); |
fclose(fin); |
fclose(fout); |
fclose(fout); |
printf("%d lines written to %s.\n", n, argv[2]); |
printf("%d lines written to %s.\n", n, argv[2]); |
|
} |
|
if(argc >= 4) { |
|
fout = fopen(argv[3], "w"); |
|
if(fout == NULL) { |
|
fprintf(stderr, "Cannot open %s for writing.\n", argv[2]); |
|
return 1; |
|
} else { |
|
char * cur, * next; |
|
fprintf(fout, "#define LIBMINIUPNPC_DOTTED_VERSION \"%s\"\n", miniupnpcVersion); |
|
next = strchr(miniupnpcVersion, '.'); |
|
if (next && *next) { |
|
*next = '\0'; |
|
next++; |
|
} |
|
fprintf(fout, "#define LIBMINIUPNPC_MAJOR_VERSION %s\n", miniupnpcVersion); |
|
cur = next; |
|
next = strchr(cur, '.'); |
|
if (next && *next) { |
|
*next = '\0'; |
|
next++; |
|
} |
|
fprintf(fout, "#define LIBMINIUPNPC_MINOR_VERSION %s\n", cur); |
|
cur = next; |
|
next = strchr(cur, '.'); |
|
if (next && *next) { |
|
*next = '\0'; |
|
next++; |
|
} |
|
fprintf(fout, "#define LIBMINIUPNPC_MICRO_VERSION %s\n", cur); |
|
fclose(fout); |
|
printf("%s written\n", argv[3]); |
|
} |
} |
} |
return 0; |
return 0; |
} |
} |