DRAFT lib: Add missing pipe prototype.
* include/unistd.h (pipe: New prototype.
This commit is contained in:
parent
0e13782f0e
commit
a76d1f2c84
|
@ -82,6 +82,7 @@ int getpgid (pid_t pid);
|
|||
int isatty (int fd);
|
||||
int link (char const *old_name, char const *new_name);
|
||||
off_t lseek (int fd, off_t offset, int whence);
|
||||
int pipe (int filedes[2]);
|
||||
ssize_t read (int fd, void *buffer, size_t size);
|
||||
ssize_t readlink (char const *file_name, char *buffer, size_t size);
|
||||
#if __SBRK_CHAR_PTRDIFF
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
extern int *__ungetc_buf;
|
||||
|
||||
int
|
||||
pclose (FILE *stream)
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <signal.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/wait.h>
|
||||
#include <unistd.h>
|
||||
|
@ -34,8 +35,6 @@
|
|||
#define SHELL_COMMAND_NAME "sh"
|
||||
#endif
|
||||
|
||||
extern int *__ungetc_buf;
|
||||
|
||||
FILE *
|
||||
popen (char const *command, char const *mode)
|
||||
{
|
||||
|
@ -61,7 +60,7 @@ popen (char const *command, char const *mode)
|
|||
// child
|
||||
int dup = (*mode == 'w'
|
||||
? dup2 (pipedes[STDIN], STDIN)
|
||||
: dup2 (pipedes[STDOUT], STDOUT))
|
||||
: dup2 (pipedes[STDOUT], STDOUT));
|
||||
if (dup < 0)
|
||||
_exit (127);
|
||||
|
||||
|
@ -109,6 +108,6 @@ popen (char const *command, char const *mode)
|
|||
// XXX misuse ungetc buffer for PID
|
||||
// XXX TODO: make proper FILE struct
|
||||
__ungetc_init ();
|
||||
__ungetc_set (filedes, pidchild);
|
||||
__ungetc_set (filedes, pid);
|
||||
return stream;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue