mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-13 06:29:11 +00:00
Add script.com and whois.com courtesy of FreeBSD
This commit is contained in:
parent
654ceaba7d
commit
1ad2f530f9
33 changed files with 1735 additions and 265 deletions
|
@ -17,9 +17,25 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/termios.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/strace.internal.h"
|
||||
|
||||
static char g_ptsname[32];
|
||||
static char g_ptsname[256];
|
||||
|
||||
/**
|
||||
* Gets name subordinate pseudoteletypewriter.
|
||||
*
|
||||
* @return static string path on success, or NULL w/ errno
|
||||
*/
|
||||
char *ptsname(int fd) {
|
||||
return ptsname_r(fd, g_ptsname, sizeof(g_ptsname)) ? g_ptsname : NULL;
|
||||
char *res;
|
||||
errno_t e;
|
||||
if (!(e = ptsname_r(fd, g_ptsname, sizeof(g_ptsname)))) {
|
||||
res = g_ptsname;
|
||||
} else {
|
||||
errno = e;
|
||||
res = 0;
|
||||
}
|
||||
STRACE("ptsname(%d) → %s% m", fd, res);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue