Get Fat Emacs working in Windows Console

This commit is contained in:
Justine Tunney 2023-08-18 04:55:57 -07:00
parent bf835de612
commit 7100b1cf91
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
34 changed files with 479 additions and 168 deletions

View file

@ -28,6 +28,7 @@
#include "libc/intrin/weaken.h"
#include "libc/runtime/zipos.internal.h"
#include "libc/sysv/consts/at.h"
#include "libc/sysv/consts/ok.h"
#include "libc/sysv/errfuns.h"
/**
@ -39,9 +40,9 @@
* @param amode can be `R_OK`, `W_OK`, `X_OK`, or `F_OK`
* @param flags can have `AT_EACCESS` and/or `AT_SYMLINK_NOFOLLOW`
* @return 0 if ok, or -1 and sets errno
* @raise EINVAL if `mode` has bad value
* @raise EINVAL if `amode` or `flags` had invalid values
* @raise EPERM if pledge() is in play without rpath promise
* @raise EACCES if access for requested `mode` would be denied
* @raise EACCES if access for requested `amode` would be denied
* @raise ENOTDIR if a directory component in `path` exists as non-directory
* @raise ENOENT if component of `path` doesn't exist or `path` is empty
* @raise ENOTSUP if `path` is a zip file and `dirfd` isn't `AT_FDCWD`
@ -53,6 +54,9 @@ int faccessat(int dirfd, const char *path, int amode, int flags) {
struct ZiposUri zipname;
if (IsAsan() && !__asan_is_valid_str(path)) {
rc = efault();
} else if ((flags & ~(AT_SYMLINK_NOFOLLOW | AT_EACCESS)) ||
!(amode == F_OK || !(amode & ~(R_OK | W_OK | X_OK)))) {
rc = einval();
} else if (__isfdkind(dirfd, kFdZip)) {
rc = enotsup();
} else if (_weaken(__zipos_open) &&