Skip to content

Commit

Permalink
musl support
Browse files Browse the repository at this point in the history
  • Loading branch information
dd86k committed Sep 6, 2021
1 parent c132900 commit 7215dce
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ddhx/ddhx.d
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ size_t format8lux(char *buffer, long v) {
private
size_t format8lud(char *buffer, long v) {
debug import std.conv : text;
enum I64MAX = 10_000_000_000_000_000_000;
enum ulong I64MAX = 10_000_000_000_000_000_000UL;
immutable static string decTable = "0123456789";
size_t pos;
bool pad = true;
Expand Down
29 changes: 29 additions & 0 deletions src/ddhx/terminal.d
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,35 @@ version (Posix) {
private import core.sys.posix.sys.ioctl;
private import core.sys.posix.unistd;
private import core.sys.posix.termios;
version (CRuntime_Musl) {
alias uint tcflag_t;
alias uint speed_t;
alias char cc_t;
private enum TCSANOW = 0;
private enum NCCS = 32;
private enum ICANON = 2;
private enum ECHO = 10;
private enum TIOCGWINSZ = 0x5413;
private struct termios {
tcflag_t c_iflag;
tcflag_t c_oflag;
tcflag_t c_cflag;
tcflag_t c_lflag;
cc_t c_line;
cc_t[NCCS] c_cc;
speed_t __c_ispeed;
speed_t __c_ospeed;
}
private struct winsize {
ushort ws_row;
ushort ws_col;
ushort ws_xpixel;
ushort ws_ypixel;
}
private extern (C) int tcgetattr(int fd, termios *termios_p);
private extern (C) int tcsetattr(int fd, int a, termios *termios_p);
private extern (C) int ioctl(int fd, ulong request, ...);
}
private enum TERM_ATTR = ~(ICANON | ECHO);
private __gshared termios old_tio, new_tio;
}
Expand Down

0 comments on commit 7215dce

Please sign in to comment.