changed argv order

This commit is contained in:
Alexander Popov 2023-07-31 23:17:53 +03:00
parent 7812b19878
commit 095ec61214
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6
4 changed files with 10 additions and 9 deletions

View File

@ -10,6 +10,7 @@
## 31/07/2023 - (1.0.3)
- ♻️ - Format code via `clang-format --style=LLVM`
- ♻️ - Changed arguments order
## 31/07/2023 - (1.0.2)
- ♻️ - Update software executable name

View File

@ -13,12 +13,12 @@ Utility for parse Minecraft JE game version file (`version.json`).
Minecraft Libraries List Generator
Usage:
mc-libs-string <version.json> <system>
mc-libs-string <system> <version.json>
<system> - w|l|x (windows or linux or osx)
Other:
mc-libs-string <version.json> i - to get version info
mc-libs-string i <version.json> - to get version info
```
Utility has two required arguments,

View File

@ -13,12 +13,12 @@
Minecraft Libraries List Generator
Usage:
mc-libs-string <version.json> <system>
mc-libs-string <system> <version.json>
<system> - w|l|x (windows or linux or osx)
Other:
mc-libs-string <version.json> i - to get version info
mc-libs-string i <version.json> - to get version info
```
Программа имеет два обязательных аргумента,

View File

@ -8,7 +8,7 @@
#include <string.h>
#include <cjson/cJSON.h>
#define VERSION "1.0.2" // software version
#define VERSION "1.1.0" // software version
void usage();
void info(cJSON *json);
@ -23,7 +23,7 @@ int main(int argc, char const *argv[]) {
char str[900000];
char buffer[100];
fp = fopen(argv[1], "r");
fp = fopen(argv[2], "r");
while (fgets(buffer, sizeof(buffer), fp)) {
strcat(str, buffer);
}
@ -38,7 +38,7 @@ int main(int argc, char const *argv[]) {
generate_library_list(json, launcher_libraries, argv[2][0]);
int libraries_array_size = cJSON_GetArraySize(libraries);
switch (argv[2][0]) {
switch (argv[1][0]) {
default:
usage();
break;
@ -70,10 +70,10 @@ void usage() {
printf("%s\n%s: %s\n\n", "Minecraft Libraries List Generator", "Version",
VERSION);
printf("%s\n", "Usage:");
printf(" %s\n\n", "mc-libs-string <version.json> <system>");
printf(" %s\n\n", "mc-libs-string <system> <version.json>");
printf(" %s\n\n", "<system> - w|l|x (windows or linux or osx)");
printf("%s\n", "Other:");
printf(" %s\n", "mc-libs-string <version.json> i - to get version info");
printf(" %s\n", "mc-libs-string i <version.json> - to get version info");
}
void info(cJSON *json) {