mirror of
https://gitlab.com/sortix/sortix.git
synced 2023-02-13 20:55:38 -05:00
Add ttyname(2).
This commit is contained in:
parent
3c4b4ace0c
commit
01a82b2882
3 changed files with 32 additions and 1 deletions
|
@ -311,6 +311,7 @@ tfork.o \
|
|||
time.o \
|
||||
truncateat.o \
|
||||
truncate.o \
|
||||
ttyname.o \
|
||||
umask.o \
|
||||
unlinkat.o \
|
||||
unlink.o \
|
||||
|
|
|
@ -136,7 +136,6 @@ void sync(void);
|
|||
long sysconf(int);
|
||||
pid_t tcgetpgrp(int);
|
||||
int tcsetpgrp(int, pid_t);
|
||||
char* ttyname(int);
|
||||
int ttyname_r(int, char*, size_t);
|
||||
|
||||
#if __POSIX_OBSOLETE <= 200801
|
||||
|
@ -195,6 +194,7 @@ int setuid(uid_t);
|
|||
unsigned sleep(unsigned);
|
||||
int truncate(const char*, off_t);
|
||||
int truncateat(int dirfd, const char*, off_t);
|
||||
char* ttyname(int);
|
||||
int usleep(useconds_t useconds);
|
||||
int unlinkat(int, const char*, int);
|
||||
int unlink(const char*);
|
||||
|
|
30
libc/ttyname.cpp
Normal file
30
libc/ttyname.cpp
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*******************************************************************************
|
||||
|
||||
Copyright(C) Jonas 'Sortie' Termansen 2013.
|
||||
|
||||
This file is part of the Sortix C Library.
|
||||
|
||||
The Sortix C Library is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU Lesser General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or (at your
|
||||
option) any later version.
|
||||
|
||||
The Sortix C Library is distributed in the hope that it will be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||||
License for more details.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public License
|
||||
along with the Sortix C Library. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
ttyname.cpp
|
||||
Returns the name of a terminal.
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
extern "C" char* ttyname(int fd)
|
||||
{
|
||||
return isatty(fd) ? (char*) "/dev/tty" : NULL;
|
||||
}
|
Loading…
Add table
Reference in a new issue