aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/config.c1
-rw-r--r--src/dxvk.c16
-rw-r--r--src/lutris.c32
-rw-r--r--src/wine.c4
4 files changed, 33 insertions, 20 deletions
diff --git a/src/config.c b/src/config.c
index 0f514f3..f05f5c1 100644
--- a/src/config.c
+++ b/src/config.c
@@ -26,7 +26,6 @@ static void getXDGDir(const char* envvar, const char* homeext, char* config, con
#endif
home = "";
}
- if (!home) home = "";
strncpy(config, home, size);
strncat(config, homeext, size - strlen(config));
}
diff --git a/src/dxvk.c b/src/dxvk.c
index 962198f..4a1295a 100644
--- a/src/dxvk.c
+++ b/src/dxvk.c
@@ -15,7 +15,7 @@ static const struct Command dxvk_commands[] = {
{ .name = "download", .func = dxvk_download, .description = "download and install a dxvk version" },
{ .name = "install", .func = dxvk_install, .description = "run the DXVK installer" },
{ .name = "list", .func = dxvk_list, .description = "list available dxvk versions" },
- { .name = "list-installed", .func = dxvk_installed, .description = "list installed dxvk versions" },
+ { .name = "installed", .func = dxvk_installed, .description = "list installed dxvk versions" },
{ .name = "remove", .func = dxvk_remove, .description = "remove a dxvk version" },
};
@@ -114,7 +114,7 @@ COMMAND(dxvk, remove)
if (!isDir(dxvkpath))
{
- fprintf(stderr, "'%s' is not an downloaded DXVK version\n", dxvkver);
+ fprintf(stderr, "'%s' is not a downloaded DXVK version\n", dxvkver);
return EXIT_SUCCESS;
}
@@ -131,7 +131,7 @@ COMMAND(dxvk, remove)
return retval;
}
- fprintf(stderr, USAGE_STR " dxvk remove <version>\n\nInstalled dxvk versions can be obtained by using '" NAME " dxvk list-installed\n");
+ fprintf(stderr, USAGE_STR " dxvk remove <version>\n\nInstalled dxvk versions can be obtained by using '" NAME " dxvk installed'\n");
return EXIT_SUCCESS;
}
@@ -143,7 +143,7 @@ COMMAND(dxvk, list)
if (runner)
{
int istty = isatty(STDOUT_FILENO);
- if (istty) puts("Installable DXVK versions:");
+ if (istty) puts("Available DXVK versions:");
for (JSON_LENGTH_TYPE i = 0; i < json_object_array_length(runner); ++i)
{
@@ -154,6 +154,8 @@ COMMAND(dxvk, list)
if (istty) printf(" - ");
printf("%s\n", json_object_get_string(name));
}
+
+ json_object_put(runner);
}
return EXIT_SUCCESS;
@@ -172,7 +174,7 @@ COMMAND(dxvk, install)
if (!isDir(dxvkpath))
{
- fprintf(stderr, "'%s' is not an downloaded DXVK version\n", dxvkver);
+ fprintf(stderr, "'%s' is not an downloaded DXVK version. Did you mean '" NAME " dxvk download'?\n", dxvkver);
return EXIT_SUCCESS;
}
@@ -203,7 +205,7 @@ COMMAND(dxvk, install)
}
else
{
- fprintf(stderr, "Specify a what DXVK version to install.\nUse '" NAME " dxvk list-installed' to list available versions\n");
+ fprintf(stderr, "Specify a what DXVK version to install.\nUse '" NAME " dxvk installed' to list available versions\n");
}
@@ -223,7 +225,7 @@ COMMAND(dxvk, installed)
int intty = isatty(STDOUT_FILENO);
- if (intty) puts("Installed DXVK versions:");
+ if (intty) puts("Downloaded DXVK versions:");
if ((dir = opendir(dxvkdir)) != NULL)
{
while ((ent = readdir(dir)) != NULL)
diff --git a/src/lutris.c b/src/lutris.c
index 3f20f37..7e94c21 100644
--- a/src/lutris.c
+++ b/src/lutris.c
@@ -34,21 +34,33 @@ COMMAND_GROUP_FUNC(lutris)
COMMAND(lutris, search)
{
- if (argc == 2 && argv[1][0] != '\0')
+ if (argc > 1 && argv[1][0] != '\0')
{
- // argv being modifyable is not always a given so lets
- // lets make a mutable copy
- char* str = strdup(argv[1]);
- if (!str) return 1;
+ size_t str_size = 0;
+ for (int i = 1; i < argc; ++i)
+ {
+ str_size += strlen(argv[i]);
+ }
+ str_size += 1; // NULL
// in the case we need to do replacing we allocate more
- // since we'll free in anyway
+ // since we'll free it anyway
// the smallest strlen can return is 0 the longest
// escapeString can return is strlen*3
- size_t allocsize = strlen(str) * 3;
- str = realloc(str, allocsize);
- if (!str) return 1;
- lutris_escapeString(str, allocsize);
+ str_size *= 3;
+
+ char* str = malloc(str_size);
+ if (!str) return 1;
+
+ str[0] = '\0';
+ for (int i = 1; i < argc; ++i)
+ {
+ if (i != 1) strncat(str, " ", str_size);
+ strncat(str, argv[i], str_size);
+ }
+ str[str_size-1] = '\0';
+
+ lutris_escapeString(str, str_size);
char* url = malloc(strlen(LUTRIS_GAME_SEARCH_API) + strlen(str));
sprintf(url, LUTRIS_GAME_SEARCH_API, str);
diff --git a/src/wine.c b/src/wine.c
index 37e2c78..b821896 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -18,8 +18,8 @@ static const struct Command winecmd_commands[] = {
{ .name = "download", .func = winecmd_download, .description = "download and extract a wine version" },
{ .name = "env", .func = winecmd_env, .description = "add wine to your PATH in a POSIX shell"},
{ .name = "env-fish", .func = winecmd_env, .description = "add wine to your PATH in the fish shell"},
- { .name = "list", .func = winecmd_list, .description = "list installable wine versions" },
- { .name = "installed", .func = winecmd_installed, .description = "list already installed wine versions" },
+ { .name = "list", .func = winecmd_list, .description = "list available wine versions" },
+ { .name = "installed", .func = winecmd_installed, .description = "list installed wine versions" },
{ .name = "remove", .func = winecmd_remove, .description = "remove a wine version" },
{ .name = "run", .func = winecmd_run, .description = "run an installed wine version" },
};