move back to proc, __static_yoink in paginate.c does not work

This commit is contained in:
Gavin Hayes 2024-04-26 01:02:54 -04:00
parent 2dfb72d278
commit 38d0728107

View file

@ -19,7 +19,9 @@
#include "libc/calls/calls.h"
#include "libc/calls/syscall_support-nt.internal.h"
#include "libc/dce.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/safemacros.internal.h"
#include "libc/intrin/weaken.h"
#include "libc/limits.h"
#include "libc/mem/gc.h"
#include "libc/runtime/runtime.h"
@ -28,6 +30,8 @@
#include "libc/temp.h"
#include "libc/x/x.h"
__static_yoink("__utf16to8");
static char *get_pagerpath(char *pathbuf, size_t pathbufsz) {
char *pagerpath;
if (strcmp(nulltoempty(getenv("TERM")), "dumb") && isatty(0) && isatty(1) &&
@ -43,9 +47,10 @@ static char *get_pagerpath(char *pathbuf, size_t pathbufsz) {
static bool run_pager(char *args[hasatleast 3]) {
char16_t widepath[PATH_MAX];
int n, pid;
kprintf("utf16to8 %p\n", _weaken(__utf16to8));
if (IsWindows() && !strcasecmp(args[0], "/C/Windows/System32/more.com") &&
(((n = __mkntpath(args[1], widepath)) == -1) ||
!(args[1] = gc(utf16to8(widepath, n, 0))))) {
(!_weaken(__utf16to8) || ((n = __mkntpath(args[1], widepath)) == -1) ||
!(args[1] = gc(_weaken(__utf16to8)(widepath, n, 0))))) {
return false;
}
if ((pid = fork()) != -1) {