Add script.com and whois.com courtesy of FreeBSD

This commit is contained in:
Justine Tunney 2022-09-13 20:11:09 -07:00
parent 654ceaba7d
commit 1ad2f530f9
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
33 changed files with 1735 additions and 265 deletions

View file

@ -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;
}