Merge \"Add ctermid.\"

am: f3c39b26b5

Change-Id: Id6c4549a355d1d6db374be2962c1c9f988e6bc74
This commit is contained in:
Elliott Hughes 2016-06-09 23:29:11 +00:00 committed by android-build-merger
commit 8d4f7acfe9
13 changed files with 24 additions and 0 deletions

View file

@ -226,6 +226,7 @@ int vsscanf(const char * __restrict, const char * __restrict, __va_list)
*/
#if __BSD_VISIBLE || __POSIX_VISIBLE || __XPG_VISIBLE
#define L_ctermid 1024 /* size for ctermid(); PATH_MAX */
char* ctermid(char*);
FILE *fdopen(int, const char *);
int fileno(FILE *);

View file

@ -1271,6 +1271,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1271,6 +1271,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1194,6 +1194,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1296,6 +1296,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1255,6 +1255,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1255,6 +1255,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1194,6 +1194,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1253,6 +1253,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1253,6 +1253,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -1194,6 +1194,7 @@ LIBC_O {
catclose;
catgets;
catopen;
ctermid;
endgrent;
endpwent;
futimes;

View file

@ -36,6 +36,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <paths.h>
#include <stdlib.h>
#include <string.h>
#include <sys/param.h>
@ -598,3 +599,7 @@ FILE* funopen64(const void* cookie,
}
return fp;
}
char* ctermid(char* s) {
return s ? strcpy(s, _PATH_TTY) : const_cast<char*>(_PATH_TTY);
}

View file

@ -1297,3 +1297,11 @@ TEST(STDIO_TEST, fseek_fseeko_EINVAL) {
fclose(fp);
}
TEST(STDIO_TEST, ctermid) {
ASSERT_STREQ("/dev/tty", ctermid(nullptr));
char buf[L_ctermid] = {};
ASSERT_EQ(buf, ctermid(buf));
ASSERT_STREQ("/dev/tty", buf);
}