summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJakob Kaivo <jkk@ung.org>2020-08-15 12:39:53 -0400
committerJakob Kaivo <jkk@ung.org>2020-08-15 12:39:53 -0400
commit69461124b0dfae2a31d426c0a7ca06a90aed2ff2 (patch)
tree59e1d447b5ec6d84de39a34b97151de325aaccb0 /src
parentfea10bb428ecaca537f12ead55087c507f0435b5 (diff)
sadly Linux-specific implementation
Diffstat (limited to 'src')
-rw-r--r--src/unistd/getpass.c2
-rw-r--r--src/unistd/sleep.c4
-rw-r--r--src/unistd/tcgetpgrp.c8
-rw-r--r--src/unistd/tcsetpgrp.c4
4 files changed, 11 insertions, 7 deletions
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 <unistd.h>
+#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 <unistd.h>
+#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);
}
/*