aboutsummaryrefslogtreecommitdiff
path: root/src/wine.c
diff options
context:
space:
mode:
authorJan200101 <sentrycraft123@gmail.com>2020-12-17 15:03:27 +0100
committerJan200101 <sentrycraft123@gmail.com>2020-12-17 15:03:27 +0100
commit3c0fae06b5ae2c59bacd2e3d6a1033f864cd368e (patch)
tree76c98db3ac25a441be13189e185ef2a586484384 /src/wine.c
parent1ca0317a351f3075b2ea0b9bb5e59ccb4bcb960b (diff)
downloadpolecat-3c0fae06b5ae2c59bacd2e3d6a1033f864cd368e.tar.gz
polecat-3c0fae06b5ae2c59bacd2e3d6a1033f864cd368e.zip
replace gnu style quoting with normal quoting, comment command macros, …
- gnu style quoting (`text') has been replaced with normal quoting ('text') - the command macros defined in command.h have been commented to explain how they are intended to be used and why they are how they - the macro that generates the command group function now prints a message if the given command has not been found (this probably needs to be extended to the other commands to be consistent)
Diffstat (limited to 'src/wine.c')
-rw-r--r--src/wine.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/src/wine.c b/src/wine.c
index a905c91..c37f7bd 100644
--- a/src/wine.c
+++ b/src/wine.c
@@ -87,7 +87,7 @@ COMMAND(wine, download)
}
else
{
- fprintf(stderr, "Could not find `%s'\n", choice);
+ fprintf(stderr, "Could not find '%s'\n", choice);
}
}
@@ -96,7 +96,7 @@ COMMAND(wine, download)
}
else
{
- fprintf(stderr, USAGE_STR " wine download [versions]\n\nversions are obtained via `" NAME " wine list'\n");
+ fprintf(stderr, USAGE_STR " wine download [versions]\n\nversions are obtained via '" NAME " wine list'\n");
}
return 0;
}
@@ -129,7 +129,7 @@ COMMAND(wine, remove)
// if it still doesn't exist tell this wine version is not installed
if (!isDir(winepath))
{
- fprintf(stderr, "`%s' is not an installed wine version\n", winever);
+ fprintf(stderr, "'%s' is not an installed wine version\n", winever);
return 0;
}
}
@@ -147,7 +147,7 @@ COMMAND(wine, remove)
return retval;
}
- fprintf(stderr, USAGE_STR " wine remove <version>\n\nInstalled wine versions can be obtained by using `" NAME " wine list-installed\n");
+ fprintf(stderr, USAGE_STR " wine remove <version>\n\nInstalled wine versions can be obtained by using '" NAME " wine list-installed\n");
return 0;
}
@@ -194,7 +194,7 @@ COMMAND(wine, run)
if (!isDir(winepath))
{
- // if the wine version does not exist try appending the system arch e.g. x86_64
+ // try appending the system arch to find the wine version
struct utsname buffer;
if (!uname(&buffer))
@@ -203,11 +203,11 @@ COMMAND(wine, run)
strncat(winepath, buffer.machine, sizeof(winepath) - strlen(winepath) - 1);
}
- // if it still doesn't exist tell this wine version is not installed
+ // if we still cannot find anything tell the user and exit
if (!isDir(winepath))
{
- fprintf(stderr, "`%s' is not an installed wine version\n", winever);
- return 0;
+ fprintf(stderr, "'%s' is not an installed wine version\n", winever);
+ return 1;
}
}
@@ -223,7 +223,7 @@ COMMAND(wine, run)
default:
#ifdef DEBUG
- fprintf(stderr, "Couldn't find figure out if this `%s' is Wine or Proton, defaulting to Wine\n", winever);
+ fprintf(stderr, "Couldn't find figure out if this '%s' is Wine or Proton, defaulting to Wine\n", winever);
#endif
winebinloc = WINEBIN;
break;
@@ -235,6 +235,7 @@ COMMAND(wine, run)
{
for (int i = 2; i < argc; ++i)
{
+ // make sure the passed arguments are in quotes so spaces don't cause problems
strncat(winepath, " \"", sizeof(winepath) - strlen(winepath) - 1);
strncat(winepath, argv[i], sizeof(winepath) - strlen(winepath) - 1);
strncat(winepath, "\"", sizeof(winepath) - strlen(winepath) - 1);
@@ -244,12 +245,12 @@ COMMAND(wine, run)
}
else
{
- fprintf(stderr, "cannot find wine for `%s'\n", winever);
+ fprintf(stderr, "cannot find wine for '%s'\n", winever);
}
}
- fprintf(stderr, "Specify a what wine version to run.\nUse `" NAME " wine list-installed' to list available versions\n");
+ fprintf(stderr, "Specify a what wine version to run.\nUse '" NAME " wine list-installed' to list available versions\n");
return 0;
}
@@ -312,7 +313,7 @@ COMMAND(wine, env)
// if it still doesn't exist tell this wine version is not installed
if (!isDir(winepath))
{
- fprintf(stderr, "`%s' is not an installed wine version\n", winever);
+ fprintf(stderr, "'%s' is not an installed wine version\n", winever);
return 0;
}
}
@@ -329,7 +330,7 @@ COMMAND(wine, env)
default:
#ifdef DEBUG
- fprintf(stderr, "Couldn't find figure out if this `%s' is Wine or Proton, defaulting to Wine", winever);
+ fprintf(stderr, "Couldn't find figure out if this '%s' is Wine or Proton, defaulting to Wine", winever);
#endif
winebinloc = WINEBIN;
break;
@@ -345,7 +346,7 @@ COMMAND(wine, env)
printf("To add a wine installation to your PATH\n"
"you have to eval the output.\n\n");
if (!fish_env)
- printf("$ eval `polecat wine env %s`\n", winever);
+ printf("$ eval 'polecat wine env %s'\n", winever);
else
printf("$ eval (polecat wine fish-env %s)\n", winever);
}
@@ -360,17 +361,17 @@ COMMAND(wine, env)
printf("set PATH %s $PATH\n", winepath);
}
}
- //printf("PATH=\"%s\"\n# Run this code in your Terminal\n# by running eval `%s`", newpath, argv[0]);
+ //printf("PATH=\"%s\"\n# Run this code in your Terminal\n# by running eval '%s'", newpath, argv[0]);
}
else
{
- fprintf(stderr, "cannot find wine for `%s'\n", winever);
+ fprintf(stderr, "cannot find wine for '%s'\n", winever);
}
}
else
{
- fprintf(stderr, "Specify a what wine version to run.\nUse `" NAME " wine list-installed' to list available versions\n");
+ fprintf(stderr, "Specify a what wine version to run.\nUse '" NAME " wine list-installed' to list available versions\n");
}