mlibc: Add isatty.
* lib/libc.c (isatty): New function. * include/unistd.h: Declare it.
This commit is contained in:
parent
979406f3a6
commit
ece39a9a18
|
@ -51,6 +51,7 @@ int access (char const *s, int mode);
|
||||||
int close (int fd);
|
int close (int fd);
|
||||||
int execvp (char const *file, char *const argv[]);
|
int execvp (char const *file, char *const argv[]);
|
||||||
char *getcwd (char *buf, size_t size);
|
char *getcwd (char *buf, size_t size);
|
||||||
|
int isatty (int fd);
|
||||||
off_t lseek (int fd, off_t offset, int whence);
|
off_t lseek (int fd, off_t offset, int whence);
|
||||||
int read (int fd, void* buf, size_t n);
|
int read (int fd, void* buf, size_t n);
|
||||||
int unlink (char const *file_name);
|
int unlink (char const *file_name);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
* along with Mes. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <sys/ioctl.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -419,4 +420,11 @@ sprintf (char *str, char const* format, ...)
|
||||||
va_end (ap);
|
va_end (ap);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
isatty (int fd)
|
||||||
|
{
|
||||||
|
return ioctl (fd, TCGETS, 0) == -14; // MAGIC
|
||||||
|
}
|
||||||
|
|
||||||
#endif //!POSIX
|
#endif //!POSIX
|
||||||
|
|
Loading…
Reference in a new issue