summaryrefslogtreecommitdiff
path: root/libc/stdlib
diff options
context:
space:
mode:
Diffstat (limited to 'libc/stdlib')
-rw-r--r--libc/stdlib/Makefile14
-rw-r--r--libc/stdlib/getpt.c18
-rw-r--r--libc/stdlib/grantpt.c8
-rw-r--r--libc/stdlib/ptsname.c10
4 files changed, 28 insertions, 22 deletions
diff --git a/libc/stdlib/Makefile b/libc/stdlib/Makefile
index aa311afcb..5bf12b322 100644
--- a/libc/stdlib/Makefile
+++ b/libc/stdlib/Makefile
@@ -24,15 +24,21 @@
TOPDIR=../../
include $(TOPDIR)Rules.mak
-DIRS = $(MALLOC)
-ALL_SUBDIRS = malloc malloc-930716
+DIRS:=
+ifeq ($(MALLOC),y)
+ DIRS+=malloc
+endif
+ifeq ($(MALLOC_930716),y)
+ DIRS+=malloc-930716
+endif
+
MSRC = stdlib.c
MOBJ = abs.o labs.o atoi.o atol.o strtol.o strtoul.o _stdlib_strto_l.o \
qsort.o bsearch.o
MOBJ += llabs.o atoll.o strtoll.o strtoull.o _stdlib_strto_ll.o
-ifeq ($(HAS_WCHAR),true)
+ifeq ($(UCLIBC_HAS_WCHAR),y)
MOBJ += mblen.o mbtowc.o wctomb.o mbstowcs.o wcstombs.o \
_stdlib_mb_cur_max.o
endif
@@ -46,7 +52,7 @@ CSRC = abort.c getenv.c mkdtemp.c mktemp.c realpath.c mkstemp.c mkstemp64.c \
drand48_r.c erand48.c erand48_r.c jrand48.c jrand48_r.c lrand48.c \
lrand48_r.c mrand48.c mrand48_r.c nrand48.c nrand48_r.c rand_r.c \
srand48.c srand48_r.c calloc.c valloc.c
-ifeq ($(HAS_FLOATING_POINT),true)
+ifeq ($(UCLIBC_HAS_FLOATS),y)
CSRC += strtod.c strtof.c strtold.c
endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
diff --git a/libc/stdlib/getpt.c b/libc/stdlib/getpt.c
index f4e52f672..71d7d6c5f 100644
--- a/libc/stdlib/getpt.c
+++ b/libc/stdlib/getpt.c
@@ -23,7 +23,7 @@
#include <unistd.h>
#include <paths.h>
-#if !defined ASSUME_DEVPTS
+#if !defined __ASSUME_DEVPTS__
# include <sys/statfs.h>
/* Constant that identifies the `devpts' filesystem. */
@@ -37,7 +37,7 @@
/* Directory containing the UNIX98 pseudo terminals. */
#define _PATH_DEVPTS _PATH_DEV "pts"
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
/* Prototype for function that opens BSD-style master pseudo-terminals. */
int __bsd_getpt (void);
#endif
@@ -46,19 +46,19 @@ int __bsd_getpt (void);
int
getpt (void)
{
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
static int have_no_dev_ptmx;
#endif
int fd;
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
if (!have_no_dev_ptmx)
#endif
{
fd = open (_PATH_DEVPTMX, O_RDWR);
if (fd != -1)
{
-#if defined ASSUME_DEVPTS
+#if defined __ASSUME_DEVPTS__
return fd;
#else
struct statfs fsbuf;
@@ -80,14 +80,14 @@ getpt (void)
/* If /dev/pts is not mounted then the UNIX98 pseudo terminals
are not usable. */
close (fd);
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
have_no_dev_ptmx = 1;
#endif
#endif
}
else
{
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
if (errno == ENOENT || errno == ENODEV)
have_no_dev_ptmx = 1;
else
@@ -96,12 +96,12 @@ getpt (void)
}
}
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
return __bsd_getpt ();
#endif
}
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
# define PTYNAME1 "pqrstuvwxyzabcde";
# define PTYNAME2 "0123456789abcdef";
diff --git a/libc/stdlib/grantpt.c b/libc/stdlib/grantpt.c
index d49f0af4f..5b4427a0c 100644
--- a/libc/stdlib/grantpt.c
+++ b/libc/stdlib/grantpt.c
@@ -19,10 +19,10 @@
#include <limits.h>
#include <stdlib.h>
-/* If ASSUME_DEVPTS is defined, grantpt() reduces to a stub since we
+/* If __ASSUME_DEVPTS__ is defined, grantpt() reduces to a stub since we
assume that the devfs/devpts filesystem automatically manages the
permissions. */
-#if !defined ASSUME_DEVPTS
+#if !defined __ASSUME_DEVPTS__
#include <sys/statfs.h>
/* Constant that identifies the `devpts' filesystem. */
@@ -47,7 +47,7 @@ static int pts_name (int fd, char **pts, size_t buf_len);
int
grantpt (int fd)
{
-#if !defined ASSUME_DEVPTS
+#if !defined __ASSUME_DEVPTS__
struct statfs fsbuf;
# ifdef PATH_MAX
char _buf[PATH_MAX];
@@ -70,7 +70,7 @@ grantpt (int fd)
return 0;
}
-#if !defined ASSUME_DEVPTS
+#if !defined __ASSUME_DEVPTS__
# define grantpt __unix_grantpt
# include "unix_grantpt.c"
#endif
diff --git a/libc/stdlib/ptsname.c b/libc/stdlib/ptsname.c
index 7f9b04e93..2472edb3f 100644
--- a/libc/stdlib/ptsname.c
+++ b/libc/stdlib/ptsname.c
@@ -30,7 +30,7 @@
#include <unistd.h>
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
/* Check if DEV corresponds to a master pseudo terminal device. */
#define MASTER_P(Dev) \
@@ -64,7 +64,7 @@ extern const char _ptyname2[];
int ptsname_r (int fd, char *buf, size_t buflen)
{
int save_errno = errno;
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
struct stat st;
#endif
int ptyno;
@@ -75,14 +75,14 @@ int ptsname_r (int fd, char *buf, size_t buflen)
return EINVAL;
}
-#if !defined UNIX98PTY_ONLY
+#if !defined __UNIX98PTY_ONLY__
if (!isatty (fd))
{
errno = ENOTTY;
return ENOTTY;
}
#elif !defined TIOCGPTN
-# error "UNIX98PTY_ONLY enabled but TIOCGPTN ioctl not supported by your kernel."
+# error "__UNIX98PTY_ONLY__ enabled but TIOCGPTN ioctl not supported by your kernel."
#endif
#ifdef TIOCGPTN
if (ioctl (fd, TIOCGPTN, &ptyno) == 0)
@@ -113,7 +113,7 @@ int ptsname_r (int fd, char *buf, size_t buflen)
return 0;
}
#endif
-#if defined UNIX98PTY_ONLY
+#if defined __UNIX98PTY_ONLY__
else
{
/* If the ioctl fails it wasn't a Unix 98 master PTY */