From 69461124b0dfae2a31d426c0a7ca06a90aed2ff2 Mon Sep 17 00:00:00 2001 From: Jakob Kaivo Date: Sat, 15 Aug 2020 12:39:53 -0400 Subject: sadly Linux-specific implementation --- src/unistd/getpass.c | 2 +- src/unistd/sleep.c | 4 ++-- src/unistd/tcgetpgrp.c | 8 ++++++-- src/unistd/tcsetpgrp.c | 4 ++-- 4 files changed, 11 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/unistd/getpass.c b/src/unistd/getpass.c index 46165742..5c48e6c8 100644 --- a/src/unistd/getpass.c +++ b/src/unistd/getpass.c @@ -2,7 +2,7 @@ char *getpass(const char *prompt) { - return prompt; + return (char*)prompt; } /* diff --git a/src/unistd/sleep.c b/src/unistd/sleep.c index 9af72481..656f70f9 100644 --- a/src/unistd/sleep.c +++ b/src/unistd/sleep.c @@ -5,8 +5,8 @@ #if _POSIX_C_SOURCE < 199309 #define nanosleep __nanosleep -#include "../time/struct_timespec.c" -#include "../time/nanosleep.c" +#include "time/struct_timespec.c" +#include "time/nanosleep.c" #endif unsigned sleep(unsigned seconds) diff --git a/src/unistd/tcgetpgrp.c b/src/unistd/tcgetpgrp.c index 13610d63..40b60a7e 100644 --- a/src/unistd/tcgetpgrp.c +++ b/src/unistd/tcgetpgrp.c @@ -1,11 +1,15 @@ #include "stddef.h" #include "sys/types.h" #include +#include "termios/_termios.h" pid_t tcgetpgrp(int fildes) { - (void)fildes; - return 0; + pid_t pid = -1; + if (ioctl(fildes, TIOCGPGRP, &pid) == -1) { + return (pid_t)-1; + } + return pid; } /* diff --git a/src/unistd/tcsetpgrp.c b/src/unistd/tcsetpgrp.c index e3cfe023..aef0acf5 100644 --- a/src/unistd/tcsetpgrp.c +++ b/src/unistd/tcsetpgrp.c @@ -1,11 +1,11 @@ #include "stddef.h" #include "sys/types.h" #include +#include "termios/_termios.h" int tcsetpgrp(int fildes, pid_t pgid_id) { - (void)fildes; (void)pgid_id; - return 0; + return ioctl(fildes, TIOCSPGRP, &pgid_id); } /* -- cgit v1.2.1