this repo has no description
13
fork

Configure Feed

Select the types of activity you want to include in your feed.

tty: shadow os.system with our own switch

When linking lib_c, os.system gets overwritten with std.c. The linux
implementation of std.c doesn't contain the constants we need.

Signed-off-by: Tim Culverhouse <tim@timculverhouse.com>

+29 -21
+29 -21
src/Tty.zig
··· 16 16 17 17 const BufferedWriter = std.io.BufferedWriter(4096, Writer); 18 18 19 + const system = switch (builtin.os.tag) { 20 + .linux => os.linux, 21 + .plan9 => os.plan9, 22 + .wasi => os.wasi, 23 + .uefi => os.uefi, 24 + else => std.c, 25 + }; 26 + 19 27 /// the original state of the terminal, prior to calling makeRaw 20 28 termios: os.termios, 21 29 ··· 227 235 // see termios(3) 228 236 raw.iflag &= ~@as( 229 237 os.tcflag_t, 230 - os.system.IGNBRK | 231 - os.system.BRKINT | 232 - os.system.PARMRK | 233 - os.system.ISTRIP | 234 - os.system.INLCR | 235 - os.system.IGNCR | 236 - os.system.ICRNL | 237 - os.system.IXON, 238 + system.IGNBRK | 239 + system.BRKINT | 240 + system.PARMRK | 241 + system.ISTRIP | 242 + system.INLCR | 243 + system.IGNCR | 244 + system.ICRNL | 245 + system.IXON, 238 246 ); 239 - raw.oflag &= ~@as(os.tcflag_t, os.system.OPOST); 247 + raw.oflag &= ~@as(os.tcflag_t, system.OPOST); 240 248 raw.lflag &= ~@as( 241 249 os.tcflag_t, 242 - os.system.ECHO | 243 - os.system.ECHONL | 244 - os.system.ICANON | 245 - os.system.ISIG | 246 - os.system.IEXTEN, 250 + system.ECHO | 251 + system.ECHONL | 252 + system.ICANON | 253 + system.ISIG | 254 + system.IEXTEN, 247 255 ); 248 256 raw.cflag &= ~@as( 249 257 os.tcflag_t, 250 - os.system.CSIZE | 251 - os.system.PARENB, 258 + system.CSIZE | 259 + system.PARENB, 252 260 ); 253 261 raw.cflag |= @as( 254 262 os.tcflag_t, 255 - os.system.CS8, 263 + system.CS8, 256 264 ); 257 - raw.cc[os.system.V.MIN] = 1; 258 - raw.cc[os.system.V.TIME] = 0; 265 + raw.cc[system.V.MIN] = 1; 266 + raw.cc[system.V.TIME] = 0; 259 267 try os.tcsetattr(fd, .FLUSH, raw); 260 268 return state; 261 269 } 262 270 263 271 const TIOCGWINSZ = switch (builtin.os.tag) { 264 272 .linux => 0x5413, 265 - .macos => ior(0x40000000, 't', 104, @sizeOf(os.system.winsize)), 273 + .macos => ior(0x40000000, 't', 104, @sizeOf(system.winsize)), 266 274 else => @compileError("Missing termiosbits for this target, sorry."), 267 275 }; 268 276 ··· 280 288 }; 281 289 282 290 fn getWinsize(fd: os.fd_t) !Winsize { 283 - var winsize = os.system.winsize{ 291 + var winsize = system.winsize{ 284 292 .ws_row = 0, 285 293 .ws_col = 0, 286 294 .ws_xpixel = 0,