mirror of
https://github.com/openbsd/ports.git
synced 2026-06-17 23:13:55 +02:00
38412f2624
From Maintainer Timo Myyra, thanks
52 lines
1.8 KiB
Plaintext
52 lines
1.8 KiB
Plaintext
Index: src/utils.c
|
|
--- src/utils.c.orig
|
|
+++ src/utils.c
|
|
@@ -18,7 +18,6 @@
|
|
#include <sys/stat.h>
|
|
#include <time.h>
|
|
#include <unistd.h>
|
|
-#include <wordexp.h>
|
|
|
|
#include "utils.h"
|
|
#include "log.h"
|
|
@@ -177,34 +176,13 @@ int string_array_length(char **s)
|
|
|
|
char *string_to_path(char *string)
|
|
{
|
|
- ASSERT_OR_RET(string, string);
|
|
-
|
|
- wordexp_t we;
|
|
- switch (wordexp(string, &we, WRDE_NOCMD | WRDE_UNDEF)) {
|
|
- case 0:
|
|
- break;
|
|
- case WRDE_BADCHAR:
|
|
- LOG_W("Expansion of \"%s\" failed. It contains invalid characters.", string);
|
|
- return string;
|
|
- case WRDE_BADVAL:
|
|
- LOG_W("Expansion of \"%s\" failed. It contains an undefined variable.", string);
|
|
- return string;
|
|
- case WRDE_CMDSUB:
|
|
- LOG_W("Expansion of \"%s\" failed. The requested command substitution is currently not supported.", string);
|
|
- return string;
|
|
- case WRDE_NOSPACE:
|
|
- LOG_W("Expansion of \"%s\" failed. We ran out of memory.", string);
|
|
- return string;
|
|
- case WRDE_SYNTAX:
|
|
- LOG_W("Expansion of \"%s\" failed. It contains invalid syntax.", string);
|
|
- return string;
|
|
+ if (string && STRN_EQ(string, "~/", 2)) {
|
|
+ char *home = g_strconcat(user_get_home(), "/", NULL);
|
|
+ string = string_replace_at(string, 0, 2, home);
|
|
+ g_free(home);
|
|
}
|
|
- g_free(string);
|
|
|
|
- char *res = g_strjoinv(" ", we.we_wordv);
|
|
- wordfree(&we);
|
|
-
|
|
- return res;
|
|
+ return string;
|
|
}
|
|
|
|
bool safe_string_to_long_long(long long *in, const char *str) {
|