diff --git a/CMakeLists.txt b/CMakeLists.txt index 7333e3e..81a9665 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -112,6 +112,7 @@ set(SOURCES src/stdio/fgetc.c src/stdio/fgetpos.c src/stdio/fgets.c + src/stdio/fileno.c src/stdio/fileutil.c src/stdio/fopen.c src/stdio/fprintf.c diff --git a/STATUS b/STATUS index d6016d6..15d2be2 100644 --- a/STATUS +++ b/STATUS @@ -99,6 +99,7 @@ TEST: Function/symbol/macro needs to be tested 7.19.5.4 freopen - 7.19.5.5 setbuf - 7.19.5.6 setvbuf - + (EXT) fileno - 7.19.6.1 fprintf - 7.19.6.2 fscanf TODO diff --git a/include/stdio.h b/include/stdio.h index 205c33a..e489f7c 100644 --- a/include/stdio.h +++ b/include/stdio.h @@ -187,6 +187,7 @@ extern void setbuf(FILE * __restrict__ __fp, char * __restrict__ __buf); extern int setvbuf(FILE * __restrict__ __fp, char * __restrict__ __buf, int __mode, size_t __size); +/* Return the file descriptor associated with __fp. */ extern int fileno(FILE *__fp); /* diff --git a/src/stdio/fileno.c b/src/stdio/fileno.c new file mode 100644 index 0000000..8d70343 --- /dev/null +++ b/src/stdio/fileno.c @@ -0,0 +1,6 @@ +#include + +int fileno(FILE *fp) +{ + return fp->fd; +}