aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--LICENSE4
-rw-r--r--src/main.c49
-rw-r--r--src/main.h1
-rw-r--r--src/mock/wine/main.c8
-rw-r--r--src/wine.c8
5 files changed, 52 insertions, 18 deletions
diff --git a/LICENSE b/LICENSE
index f288702..58e6c18 100644
--- a/LICENSE
+++ b/LICENSE
@@ -632,7 +632,7 @@ state the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
- Copyright (C) <year> <name of author>
+ Copyright (C) 2020-2022 Jan Drögehoff
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -652,7 +652,7 @@ Also add information on how to contact you by electronic and paper mail.
If the program does terminal interaction, make it output a short
notice like this when it starts in an interactive mode:
- <program> Copyright (C) <year> <name of author>
+ <program> Copyright (C) 2020-2022 Jan Drögehoff
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
diff --git a/src/main.c b/src/main.c
index 67f99db..16bb0bb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -38,12 +38,26 @@ static const struct Command main_commands[] = {
static const struct Flag main_flags[] = {
{ .name = "help", .variant = TWO, .returns = 1, .func = main_help, .description = "show this message"},
+ { .name = "license", .variant = TWO, .returns = 1, .func = main_license, .description = "display the software license"},
{ .name = "version", .variant = BOTH, .returns = 1, .func = main_version, .description = "prints the program version"}
};
COMMAND_GROUP(main)
{
#ifdef WINE_ENABLED
+ /*
+ * if ran binary is starts with wine-
+ * its likely that it ends with a wine version
+ * so we rewrite the argv from
+ * `wine-6.0` to `wine-6.0 wine run 6.0`
+ * which will follow the command path down for
+ * running wine.
+ *
+ * Since we run wine by replacing ourselves
+ * this leaves a seamless experience
+ * where the launched PID ends up as wine
+ */
+
char* arg0 = basename(argv[0]);
if (!strncmp(WINE_PREFIX, arg0, strlen(WINE_PREFIX)))
{
@@ -74,23 +88,46 @@ COMMAND(main, env)
{
char buffer[PATH_MAX];
- printf("user-Agent:\t\t%s\n", USER_AGENT);
+ printf("User-Agent\t\t%s\n", USER_AGENT);
- getConfigDir(buffer, sizeof(buffer));
- printf("config dir\t\t%s\n", buffer);
+ /* the config dir is unused for now */
+ /*getConfigDir(buffer, sizeof(buffer));*/
+ /*printf("config directory\t\t%s\n", buffer);*/
getDataDir(buffer, sizeof(buffer));
- printf("data dir\t\t%s\n", buffer);
+ printf("data directory\t%s\n", buffer);
return EXIT_SUCCESS;
}
-COMMAND(main, version)
+COMMAND(main, license)
{
- puts(VERSION);
+ puts(
+ "\t" NAME ", a wine version manager\n"
+ "\tCopyright (C) 2020-2022 Jan Drögehoff\n"
+ "\n"
+ "\tThis program is free software: you can redistribute it and/or modify\n"
+ "\tit under the terms of the GNU General Public License as published by\n"
+ "\tthe Free Software Foundation, either version 3 of the License, or\n"
+ "\t(at your option) any later version.\n"
+ "\n"
+ "\tThis program is distributed in the hope that it will be useful,\n"
+ "\tbut WITHOUT ANY WARRANTY; without even the implied warranty of\n"
+ "\tMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n"
+ "\tGNU General Public License for more details.\n"
+ "\n"
+ "\tYou should have received a copy of the GNU General Public License\n"
+ "\talong with this program. If not, see <https://www.gnu.org/licenses/>."
+ );
return EXIT_SUCCESS;
}
+COMMAND(main, version)
+{
+ puts(VERSION);
+ return EXIT_SUCCESS;
+}
+
COMMAND_HELP(main, "")
diff --git a/src/main.h b/src/main.h
index c786179..f3d0f6a 100644
--- a/src/main.h
+++ b/src/main.h
@@ -6,6 +6,7 @@
#define WINE_PREFIX "wine-"
COMMAND(main, env);
+COMMAND(main, license);
COMMAND(main, version);
COMMAND(main, help);
diff --git a/src/mock/wine/main.c b/src/mock/wine/main.c
index 4cb063e..8d3203b 100644
--- a/src/mock/wine/main.c
+++ b/src/mock/wine/main.c
@@ -2,7 +2,9 @@
int main(int argc, char** argv)
{
- for (int i = 0; i < argc; ++i)
- printf("%s ", argv[i]);
- puts("");
+ puts("Mock");
+
+ for (int i = 0; i < argc; ++i)
+ printf("%s ", argv[i]);
+ puts("");
}
diff --git a/src/wine.c b/src/wine.c
index b821896..a88c874 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -219,6 +219,7 @@ COMMAND(winecmd, run)
switch(check_wine_ver(winepath, sizeof(winepath)+1))
{
+ default:
case WINE_NORMAL:
winebinloc = WINEBIN;
break;
@@ -226,13 +227,6 @@ COMMAND(winecmd, run)
case WINE_PROTON:
winebinloc = PROTONBIN;
break;
-
- default:
- #ifndef NDEBUG
- fprintf(stderr, "Couldn't find figure out if this '%s' is Wine or Proton, defaulting to Wine\n", winever);
- #endif
- winebinloc = WINEBIN;
- break;
}
strncat(winepath, winebinloc, sizeof(winepath) - strlen(winepath) - 1);