still more windows garbage

pull/1979/head
nick black 3 years ago
parent 0ae839c63d
commit dae8e340d2
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -45,6 +45,7 @@ sudo apt-get update
![Linux](https://img.shields.io/badge/-Linux-grey?logo=linux)
![FreeBSD](https://img.shields.io/badge/-FreeBSD-grey?logo=freebsd)
![Windows](https://img.shields.io/badge/-Windows-grey?logo=windows)
![OSX](https://img.shields.io/badge/-OSX-grey?logo=osx)
[![Matrix](https://img.shields.io/matrix/notcursesdev:matrix.org?label=matrixchat)](https://app.element.io/#/room/#notcursesdev:matrix.org)
[![Sponsor](https://img.shields.io/badge/-Sponsor-red?logo=github)](https://github.com/sponsors/dankamongmen)
@ -120,7 +121,7 @@ may well be possible to use still older versions. Let me know of any successes!
* (OPTIONAL) (documentation) [pandoc](https://pandoc.org/index.html) 1.19.2+
* (OPTIONAL) (python bindings): Python 3.7+, [CFFI](https://pypi.org/project/cffi/) 1.13.2+, [pypandoc](https://pypi.org/project/pypandoc/) 1.5+
* (OPTIONAL) (rust bindings): rust 1.47.0+, [bindgen](https://crates.io/crates/bindgen) 0.55.1+, pkg-config 0.3.18+, cty 0.2.1+
* (runtime) Linux 5.3+, FreeBSD 11+, DragonFly BSD 5.9+, or OSX 11.4+
* (runtime) Linux 5.3+, FreeBSD 11+, DragonFly BSD 5.9+, Windows Vista+, or OSX 11.4+
[Here's more information](INSTALL.md) on building and installation.

@ -1,5 +1,22 @@
#ifndef __linux__
#ifndef __FreeBSD__
#ifdef __MINGW64__
#include <string.h>
#include <stdlib.h>
char* strndup(const char* str, size_t size){
size_t t = strlen(str);
if(t > size){
t = size;
}
++t;
char* r = malloc(str);
if(r){
memcpy(r, str, t);
r[t] = '\0';
}
return r;
}
#else
#include <time.h>
#include <stdint.h>
#include "compat/compat.h"
@ -30,3 +47,4 @@ int clock_nanosleep(clockid_t clockid, int flags, const struct timespec *request
#endif
#endif
#endif
#endif

@ -5,6 +5,8 @@
extern "C" {
#endif
#include "lib/logging.h"
#include <time.h>
#define NANOSECS_IN_SEC 1000000000ul
@ -13,6 +15,17 @@ extern "C" {
#define TIMER_ABSTIME 1
#endif
#ifdef __MINGW64__
// FIXME placeholders
#define tcgetattr(x, y) -1
#define tcsetattr(x, y, z) -1
#define ICANON 0
#define ECHO 0
#define TCSAFLUSH 0
#define TCSANOW 0
#define nl_langinfo(x) NULL
#endif
static inline uint64_t
timespec_to_ns(const struct timespec* ts){
return ts->tv_sec * NANOSECS_IN_SEC + ts->tv_nsec;

@ -1028,6 +1028,8 @@ blocking_write(int fd, const char* buf, size_t buflen){
}else{
written += w;
}
// FIXME ought use WSAPoll() on windows
#ifndef __MINGW64__
if(written < buflen){
struct pollfd pfd = {
.fd = fd,
@ -1036,6 +1038,7 @@ blocking_write(int fd, const char* buf, size_t buflen){
};
poll(&pfd, 1, -1);
}
#endif
}
return 0;
}

Loading…
Cancel
Save