Skip to content

Commit c248090

Browse files
Merge pull request #30 from Jun-Software/development
v1.14.13
2 parents c6b286d + 40bd1c5 commit c248090

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

src/init.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
using namespace std;
1515
#pragma GCC std("c++11")
1616
// Version of the program
17-
const string _VERSION_ = "v1.14.12";
17+
const string _VERSION_ = "v1.14.13";
1818
// Buffer size
1919
const int _BUFFER_SIZE_ = 1024;
2020
// All identifiers.

src/update.hpp

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,30 +8,30 @@
88

99
// execute external command and store result in result
1010
string execute(const char *command) {
11-
char buffer[1024];
12-
char result[1024] = {0};
13-
FILE *ptr;
14-
strcpy(result, command);
15-
if((ptr = popen(result, "r"))) {
16-
while (fgets(buffer, 1024, ptr)) {
17-
strcat(result, buffer);
18-
if (strlen(result) > 1024) {
19-
break;
20-
}
21-
}
22-
pclose(ptr);
23-
ptr = NULL;
24-
}
25-
return result;
11+
char buffer[2048];
12+
char result[2048] = {0};
13+
FILE *ptr;
14+
strcpy(result, command);
15+
if ((ptr = popen(result, "r"))) {
16+
while (fgets(buffer, 2048, ptr)) {
17+
if (strlen(result) + strlen(buffer) <= 2048) {
18+
strcat(result, buffer);
19+
}
20+
}
21+
pclose(ptr);
22+
ptr = NULL;
23+
}
24+
return result;
2625
}
2726

2827
// update function
2928
void update() {
30-
// get version number from https://junlang.imjcj.eu.org/VERSION
31-
string result = execute("curl -s https://junlang.imjcj.eu.org/VERSION").substr(44);
32-
// compare version number with _VERSION_
33-
if (result != _VERSION_ + '\n') {
34-
cout << "Warning: Please update: \"https://junlang.imjcj.eu.org\"" << endl;
35-
}
36-
return;
29+
// get version number from https://junlang.imjcj.eu.org/VERSION
30+
string result = execute("curl -s https://junlang.imjcj.eu.org/VERSION");
31+
result = result.substr(44);
32+
// compare version number with _VERSION_
33+
if (result != _VERSION_ + '\n') {
34+
cout << "Warning: Please update: \"https://junlang.imjcj.eu.org\"" << endl;
35+
}
36+
return;
3737
}

0 commit comments

Comments
 (0)