fix mkpty function declarations

This commit is contained in:
Emile Clark-Boman 2025-09-09 19:43:54 +10:00
parent a1e34376de
commit 2893caf8ab
3 changed files with 14 additions and 6 deletions

View file

@ -1,6 +1,7 @@
#include "mkpty.h"
#include "sys/types.h"
#include <stdio.h>
#include <stdlib.h>
#include "mkpty.h"
// struct d_window {
// int ptmx; // fd
@ -16,9 +17,14 @@ int main(int argc, char **argv) {
pid_t pid;
switch (pid = forkmkpty()) {
case -1:
perror("forkmkpty");
break;
case 0:
printf("fork: children\n");
break;
default:
printf("fork: parent\n");
break;
}
return EXIT_SUCCESS;
}

View file

@ -113,7 +113,7 @@ int bindpty(const int fdty) {
* forkpty() function. It exists as a learning resource.
* REF: https://sourceware.org/git/glibc.git -> ./login/forkpty.c
*/
pid_t forkmkpty() {
pid_t forkmkpty(void) {
int fdmx, fds;
pid_t pid;
if (mkpty(&fdmx, &fds))

View file

@ -3,10 +3,12 @@
#include <sys/types.h>
/* Custom implementations of openpty() */
/* Custom implementation of glibc::openpty() */
int mkpty(int *fdmx, int *fds);
/* Custom implementations of forkpty() */
pid_t forkmkpty();
/* Custom implementation of glibc::login_tty() */
int bindpty(const int fdty);
/* Custom implementation of glibc::forkpty() */
pid_t forkmkpty(void);
int setptsxy(const unsigned short rows, const unsigned short cols, const int fds);
int getptsxy(unsigned short *rows, unsigned short *cols, const int fds);