windows: no sys/ioctl.h, move to compat.h

This commit is contained in:
nick black 2021-07-22 18:41:06 -04:00
parent 8332ff060c
commit fd13b70d27
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 7 additions and 6 deletions

View File

@ -25,7 +25,6 @@ extern "C" {
#define TCSANOW 0 #define TCSANOW 0
#define O_CLOEXEC O_NOINHERIT #define O_CLOEXEC O_NOINHERIT
#define O_NOCTTY 0 #define O_NOCTTY 0
#define nl_langinfo(x) NULL
#define sigdelset(x, y) #define sigdelset(x, y)
#define sigaddset(x, y) #define sigaddset(x, y)
typedef struct siginfo_t { typedef struct siginfo_t {
@ -41,6 +40,8 @@ typedef struct sigaction {
#define nl_langinfo(x) "UTF-8" #define nl_langinfo(x) "UTF-8"
#define sigaction(x, y, z) #define sigaction(x, y, z)
#define ppoll(w, x, y, z) WSAPoll((w), (x), (y)) #define ppoll(w, x, y, z) WSAPoll((w), (x), (y))
#else
#include <sys/ioctl.h>
#endif #endif
static inline uint64_t static inline uint64_t

View File

@ -2,6 +2,7 @@
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include <pthread.h> #include <pthread.h>
#include <inttypes.h>
#include "notcurses/notcurses.h" #include "notcurses/notcurses.h"
#include "internal.h" #include "internal.h"
@ -69,7 +70,7 @@ const char *ncmetric(uintmax_t val, uintmax_t decimal, char *buf, int omitdec,
// 1,024). That can overflow with large 64-bit values, but we can first // 1,024). That can overflow with large 64-bit values, but we can first
// divide both sides by mult, and then scale by 100. // divide both sides by mult, and then scale by 100.
if(omitdec && (val % dv) == 0){ if(omitdec && (val % dv) == 0){
sprintfed = sprintf(buf, "%ju%lc", val / dv, (wint_t)prefixes[consumed - 1]); sprintfed = sprintf(buf, "%" PRIu64 "%lc", val / dv, (wint_t)prefixes[consumed - 1]);
}else{ }else{
sprintfed = sprintf(buf, "%.2f%lc", (double)val / dv, (wint_t)prefixes[consumed - 1]); sprintfed = sprintf(buf, "%.2f%lc", (double)val / dv, (wint_t)prefixes[consumed - 1]);
} }
@ -83,9 +84,9 @@ const char *ncmetric(uintmax_t val, uintmax_t decimal, char *buf, int omitdec,
// val / decimal < dv (or we ran out of prefixes) // val / decimal < dv (or we ran out of prefixes)
if(omitdec && val % decimal == 0){ if(omitdec && val % decimal == 0){
if(consumed){ if(consumed){
sprintfed = sprintf(buf, "%ju%lc", val / decimal, (wint_t)subprefixes[consumed - 1]); sprintfed = sprintf(buf, "%" PRIu64 "%lc", val / decimal, (wint_t)subprefixes[consumed - 1]);
}else{ }else{
sprintfed = sprintf(buf, "%ju", val / decimal); sprintfed = sprintf(buf, "%" PRIu64, val / decimal);
} }
}else{ }else{
if(consumed){ if(consumed){

View File

@ -17,8 +17,8 @@
#include <unistr.h> #include <unistr.h>
#include <locale.h> #include <locale.h>
#include <uniwbrk.h> #include <uniwbrk.h>
#include <sys/ioctl.h>
#include <notcurses/direct.h> #include <notcurses/direct.h>
#include "compat/compat.h"
#define ESC "\x1b" #define ESC "\x1b"

View File

@ -4,7 +4,6 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <locale.h> #include <locale.h>
#include <sys/ioctl.h>
#include <notcurses/direct.h> #include <notcurses/direct.h>
// can we leave what was already on the screen there? (narrator: it seems not) // can we leave what was already on the screen there? (narrator: it seems not)