mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-22 02:40:08 +00:00
Update.
1997-07-14 23:37 Ulrich Drepper <drepper@cygnus.com> * inet/getnameinfo.c: Pretty print. Correctly enlarge buffers. * login/programs/utmpd.c: Use _() instead of gettext(). * nis/nss_nisplus/nisplus-hosts.c: Optimize some uses of stpcpy away. * nis/nss_nisplus/nisplus-network.c: Likewise. * nis/nss_nisplus/nisplus-proto.c: Likewise. * nis/nss_nisplus/nisplus-rpc.c: Likewise. * nis/nss_nisplus/nisplus-service.c: Likewise. * sysdeps/alpha/fpu/bits/mathinline.h: Only define functions if __OPTIMIZE__. * sysdeps/powerpc/bits/mathinline.h: Likewise. * sysdeps/i386/fpu/bits/mathinline.h: Define ISO C9x comparison function always. * sysdeps/m68k/fpu/bits/mathinline.h: Likewise. * sysdeps/stub/bits/mathinline.h: Add conditionals to show how it should look like in real files. * sysdeps/generic/bits/select.h (__FD_ZERO): Don't use memset to prevent prototype trouble, use simple loop. * sysdeps/i386/bits/select.h [!__GNUC__] (__FD_ZERO): Likewise. * sysdeps/mips/mips64/Implies: Imply ieee754. * sysdeps/unix/sysv/linux/Makefile: Make sure bits/syscall.h is installed. * sysdeps/unix/sysv/linux/sys/syscal.h: Pretty print. 1997-07-14 00:25 Ulrich Drepper <drepper@cygnus.com> * sysdeps/stub/bits/stdio_lim.h: Unify with standalone version. * sysdeps/standalone/bits/stdio_lim.h: Removed. Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>. 1997-06-22 Paul Eggert <eggert@twinsun.com> * time/strftime.c (strftime): Use tm_zone if available, even if _LIBC. * time/tzfile.c (__tzstring): New decl. (__tzfile_read, __tzfile_default): Set __tzname to permanent strings. (__tzfile_default): First two args are now const char *. * time/tzset.c (__tzstring): New function. (tz_rule): Name is now const char *. (struct tzstring_head): New type. (tzstring_list, tzstring_last_buffer_size): New static vars. (__tzset_internal): Time zone names are now permanent, not temporary.
This commit is contained in:
parent
f21acc89c0
commit
cd6ede759f
52
ChangeLog
52
ChangeLog
@ -1,3 +1,55 @@
|
||||
1997-07-14 23:37 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* inet/getnameinfo.c: Pretty print.
|
||||
Correctly enlarge buffers.
|
||||
|
||||
* login/programs/utmpd.c: Use _() instead of gettext().
|
||||
|
||||
* nis/nss_nisplus/nisplus-hosts.c: Optimize some uses of stpcpy away.
|
||||
* nis/nss_nisplus/nisplus-network.c: Likewise.
|
||||
* nis/nss_nisplus/nisplus-proto.c: Likewise.
|
||||
* nis/nss_nisplus/nisplus-rpc.c: Likewise.
|
||||
* nis/nss_nisplus/nisplus-service.c: Likewise.
|
||||
|
||||
* sysdeps/alpha/fpu/bits/mathinline.h: Only define functions if
|
||||
__OPTIMIZE__.
|
||||
* sysdeps/powerpc/bits/mathinline.h: Likewise.
|
||||
* sysdeps/i386/fpu/bits/mathinline.h: Define ISO C9x comparison
|
||||
function always.
|
||||
* sysdeps/m68k/fpu/bits/mathinline.h: Likewise.
|
||||
* sysdeps/stub/bits/mathinline.h: Add conditionals to show how
|
||||
it should look like in real files.
|
||||
|
||||
* sysdeps/generic/bits/select.h (__FD_ZERO): Don't use memset to
|
||||
prevent prototype trouble, use simple loop.
|
||||
* sysdeps/i386/bits/select.h [!__GNUC__] (__FD_ZERO): Likewise.
|
||||
|
||||
* sysdeps/mips/mips64/Implies: Imply ieee754.
|
||||
|
||||
* sysdeps/unix/sysv/linux/Makefile: Make sure bits/syscall.h is
|
||||
installed.
|
||||
* sysdeps/unix/sysv/linux/sys/syscal.h: Pretty print.
|
||||
|
||||
1997-07-14 00:25 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* sysdeps/stub/bits/stdio_lim.h: Unify with standalone version.
|
||||
* sysdeps/standalone/bits/stdio_lim.h: Removed.
|
||||
Patch by Zack Weinberg <zack@rabi.phys.columbia.edu>.
|
||||
|
||||
1997-06-22 Paul Eggert <eggert@twinsun.com>
|
||||
|
||||
* time/strftime.c (strftime): Use tm_zone if available, even if _LIBC.
|
||||
|
||||
* time/tzfile.c (__tzstring): New decl.
|
||||
(__tzfile_read, __tzfile_default): Set __tzname to permanent strings.
|
||||
(__tzfile_default): First two args are now const char *.
|
||||
|
||||
* time/tzset.c (__tzstring): New function.
|
||||
(tz_rule): Name is now const char *.
|
||||
(struct tzstring_head): New type.
|
||||
(tzstring_list, tzstring_last_buffer_size): New static vars.
|
||||
(__tzset_internal): Time zone names are now permanent, not temporary.
|
||||
|
||||
1997-07-13 01:18 Ulrich Drepper <drepper@cygnus.com>
|
||||
|
||||
* setjmp/setjmp.h: Define _setjmp and _longjmp also if __USE_XOPEN.
|
||||
|
@ -21,9 +21,16 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* This line MUST be split! Otherwise m4 will not change it. */
|
||||
#define __FD_ZERO(set) \
|
||||
((void) memset ((__ptr_t) (set), 0, sizeof (fd_set)))
|
||||
/* This line MUST be split! Otherwise m4 will not change it.
|
||||
|
||||
We don't use `memset' because this would require a prototype and
|
||||
the array isn't too big. */
|
||||
#define __FD_ZERO(set) \
|
||||
do { \
|
||||
unsigned int __i; \
|
||||
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
|
||||
((__fd_mask *) set)[__i] = '\0'; \
|
||||
} while (0)
|
||||
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
|
||||
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
|
||||
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
|
||||
|
@ -65,255 +65,313 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
#include <arpa/inet.h>
|
||||
|
||||
#ifndef AF_LOCAL
|
||||
#define AF_LOCAL AF_UNIX
|
||||
# define AF_LOCAL AF_UNIX
|
||||
#endif /* AF_LOCAL */
|
||||
|
||||
#if HOSTTABLE
|
||||
struct hostent *_addr2hostname_hosts(const char *, int, int);
|
||||
struct hostent *_addr2hostname_hosts (const char *, int, int);
|
||||
#endif /* HOSTTABLE */
|
||||
|
||||
#ifndef min
|
||||
#define min(x,y) (((x) > (y)) ? (y) : (x))
|
||||
# define min(x,y) (((x) > (y)) ? (y) : (x))
|
||||
#endif /* min */
|
||||
|
||||
static const char *domain;
|
||||
|
||||
static char *nrl_domainname(void)
|
||||
static char *
|
||||
nrl_domainname (void)
|
||||
{
|
||||
static const char *domain = NULL;
|
||||
static int first = 1;
|
||||
|
||||
if (first) {
|
||||
if (first)
|
||||
{
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
__libc_lock_lock (lock);
|
||||
|
||||
__libc_lock_define_initialized (static, lock);
|
||||
__libc_lock_lock (lock);
|
||||
if (first)
|
||||
{
|
||||
char *c;
|
||||
struct hostent *h, th;
|
||||
int tmpbuflen = 1024;
|
||||
char *tmpbuf = alloca (tmpbuflen);
|
||||
int herror;
|
||||
|
||||
if (first) {
|
||||
char *c;
|
||||
struct hostent *h, th;
|
||||
int tmpbuflen = 1024;
|
||||
char *tmpbuf = __alloca(tmpbuflen);
|
||||
int herror;
|
||||
first = 0;
|
||||
|
||||
first = 0;
|
||||
|
||||
while (__gethostbyname_r("localhost", &th, tmpbuf, tmpbuflen, &h,
|
||||
&herror)) {
|
||||
if (herror == NETDB_INTERNAL) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (h && (c = strchr(h->h_name, '.'))) {
|
||||
domain = __strdup (++c);
|
||||
goto ret;
|
||||
}
|
||||
|
||||
while (gethostname (tmpbuf, tmpbuflen)) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca (tmpbuflen);
|
||||
}
|
||||
if (c = strchr(tmpbuf, '.')) {
|
||||
domain = __strdup(++c);
|
||||
goto ret;
|
||||
}
|
||||
|
||||
while (__gethostbyname_r(tmpbuf, &th, tmpbuf, tmpbuflen, &h,
|
||||
&herror)) {
|
||||
if (herror == NETDB_INTERNAL) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (h && (c = strchr(h->h_name, '.'))) {
|
||||
domain = __strdup(++c);
|
||||
goto ret;
|
||||
}
|
||||
|
||||
{
|
||||
struct in_addr in_addr;
|
||||
|
||||
in_addr.s_addr = htonl(0x7f000001);
|
||||
|
||||
while (__gethostbyaddr_r((const char *)&in_addr,
|
||||
sizeof(struct in_addr), AF_INET, &th, tmpbuf,
|
||||
tmpbuflen, &h, &herror)) {
|
||||
if (herror == NETDB_INTERNAL) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
while (__gethostbyname_r ("localhost", &th, tmpbuf, tmpbuflen, &h,
|
||||
&herror))
|
||||
{
|
||||
if (herror == NETDB_INTERNAL && errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (h && (c = strchr (h->h_name, '.')))
|
||||
domain = __strdup (++c);
|
||||
else
|
||||
{
|
||||
/* The name contains no domain information. Use the name
|
||||
now to get more information. */
|
||||
while (gethostname (tmpbuf, tmpbuflen))
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
|
||||
if ((c = strchr (tmpbuf, '.')))
|
||||
domain = __strdup (++c);
|
||||
else
|
||||
{
|
||||
/* We need to preserve the hostname. */
|
||||
const char *hstname = strdupa (tmpbuf);
|
||||
|
||||
while (__gethostbyname_r (hstname, &th, tmpbuf, tmpbuflen,
|
||||
&h, &herror))
|
||||
{
|
||||
if (herror == NETDB_INTERNAL && errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (h && (c = strchr(h->h_name, '.')))
|
||||
domain = __strdup (++c);
|
||||
else
|
||||
{
|
||||
struct in_addr in_addr;
|
||||
|
||||
in_addr.s_addr = htonl (0x7f000001);
|
||||
|
||||
while (__gethostbyaddr_r ((const char *) &in_addr,
|
||||
sizeof (struct in_addr),
|
||||
AF_INET, &th, tmpbuf,
|
||||
tmpbuflen, &h, &herror))
|
||||
{
|
||||
if (herror == NETDB_INTERNAL && errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
if (h && (c = strchr (h->h_name, '.')))
|
||||
domain = __strdup (++c);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (h && (c = strchr(h->h_name, '.'))) {
|
||||
domain = __strdup(++c);
|
||||
goto ret;
|
||||
}
|
||||
}
|
||||
|
||||
__libc_lock_unlock (lock);
|
||||
}
|
||||
|
||||
ret:
|
||||
__libc_lock_unlock (lock);
|
||||
}
|
||||
|
||||
return domain;
|
||||
};
|
||||
|
||||
int getnameinfo(const struct sockaddr *sa, size_t addrlen, char *host, size_t hostlen, char *serv, size_t servlen, int flags)
|
||||
|
||||
int
|
||||
getnameinfo (const struct sockaddr *sa, size_t addrlen, char *host,
|
||||
size_t hostlen, char *serv, size_t servlen, int flags)
|
||||
{
|
||||
int serrno = errno;
|
||||
int tmpbuflen = 1024;
|
||||
int herrno;
|
||||
char *tmpbuf = __alloca(tmpbuflen);
|
||||
char *tmpbuf = alloca (tmpbuflen);
|
||||
struct hostent th;
|
||||
|
||||
if (!sa)
|
||||
if (sa == NULL)
|
||||
return -1;
|
||||
|
||||
if (host && (hostlen > 0))
|
||||
switch(sa->sa_family) {
|
||||
if (host != NULL && hostlen > 0)
|
||||
switch(sa->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
#if INET6
|
||||
case AF_INET6:
|
||||
#endif /* INET6 */
|
||||
if (!(flags & NI_NUMERICHOST)) {
|
||||
struct hostent *h = NULL;
|
||||
if (!(flags & NI_NUMERICHOST))
|
||||
{
|
||||
struct hostent *h = NULL;
|
||||
#if HOSTTABLE
|
||||
#if INET6
|
||||
if (sa->sa_family == AF_INET6)
|
||||
h = _addr2hostname_hosts((void *)&(((struct sockaddr_in6 *)sa)->sin6_addr), sizeof(struct in6_addr), AF_INET6);
|
||||
else
|
||||
#endif /* INET6 */
|
||||
h = _addr2hostname_hosts((void *)&(((struct sockaddr_in *)sa)->sin_addr), sizeof(struct in_addr), AF_INET);
|
||||
# if INET6
|
||||
if (sa->sa_family == AF_INET6)
|
||||
h = _addr2hostname_hosts ((void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
|
||||
sizeof(struct in6_addr), AF_INET6);
|
||||
else
|
||||
# endif /* INET6 */
|
||||
h = _addr2hostname_hosts ((void *)& (((struct sockaddr_in *) sa)->sin_addr),
|
||||
sizeof(struct in_addr), AF_INET);
|
||||
#endif /* HOSTTABLE */
|
||||
|
||||
#if RESOLVER
|
||||
if (!h) {
|
||||
if (h == NULL)
|
||||
{
|
||||
#if INET6
|
||||
if (sa->sa_family == AF_INET6) {
|
||||
while (__gethostbyaddr_r((void *)&(((struct sockaddr_in6 *)sa)->sin6_addr), sizeof(struct in6_addr), AF_INET6, &th, tmpbuf, tmpbuflen, &h, &herrno)) {
|
||||
if (herrno == NETDB_INTERNAL) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
} else {
|
||||
__set_h_errno(herrno);
|
||||
goto fail;
|
||||
if (sa->sa_family == AF_INET6)
|
||||
{
|
||||
while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
|
||||
sizeof(struct in6_addr),
|
||||
AF_INET6, &th, tmpbuf, tmpbuflen,
|
||||
&h, &herrno))
|
||||
{
|
||||
if (herrno == NETDB_INTERNAL)
|
||||
{
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
else
|
||||
{
|
||||
__set_h_errno (herrno);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
else
|
||||
{
|
||||
#endif /* INET6 */
|
||||
while (__gethostbyaddr_r((void *)&(((struct sockaddr_in *)sa)->sin_addr), sizeof(struct in_addr), AF_INET, &th, tmpbuf, tmpbuflen, &h, &herrno)) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
while (__gethostbyaddr_r ((void *) &(((struct sockaddr_in *)sa)->sin_addr),
|
||||
sizeof(struct in_addr), AF_INET,
|
||||
&th, tmpbuf, tmpbuflen,
|
||||
&h, &herrno))
|
||||
{
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = alloca (tmpbuflen);
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif /* RESOLVER */
|
||||
|
||||
if (h) {
|
||||
if (flags & NI_NOFQDN) {
|
||||
char *c;
|
||||
if ((c = nrl_domainname()) && (c = strstr(h->h_name, c)) && (c != h->h_name) && (*(--c) == '.')) {
|
||||
strncpy(host, h->h_name, min(hostlen, (size_t) (c - h->h_name)));
|
||||
if (h)
|
||||
{
|
||||
if (flags & NI_NOFQDN)
|
||||
{
|
||||
char *c;
|
||||
if ((c = nrl_domainname ()) && (c = strstr(h->h_name, c))
|
||||
&& (c != h->h_name) && (*(--c) == '.'))
|
||||
{
|
||||
strncpy (host, h->h_name,
|
||||
min(hostlen, (size_t) (c - h->h_name)));
|
||||
break;
|
||||
}
|
||||
}
|
||||
strncpy (host, h->h_name, hostlen);
|
||||
break;
|
||||
};
|
||||
};
|
||||
strncpy(host, h->h_name, hostlen);
|
||||
break;
|
||||
};
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
if (flags & NI_NAMEREQD)
|
||||
goto fail;
|
||||
|
||||
{
|
||||
const char *c;
|
||||
else
|
||||
{
|
||||
const char *c;
|
||||
#if INET6
|
||||
if (sa->sa_family == AF_INET6)
|
||||
c = inet_ntop(AF_INET6, (void *)&(((struct sockaddr_in6 *)sa)->sin6_addr), host, hostlen);
|
||||
else
|
||||
if (sa->sa_family == AF_INET6)
|
||||
c = inet_ntop (AF_INET6,
|
||||
(void *) &(((struct sockaddr_in6 *) sa)->sin6_addr),
|
||||
host, hostlen);
|
||||
else
|
||||
#endif /* INET6 */
|
||||
c = inet_ntop(AF_INET, (void *)&(((struct sockaddr_in *)sa)->sin_addr), host, hostlen);
|
||||
c = inet_ntop (AF_INET,
|
||||
(void *) &(((struct sockaddr_in *) sa)->sin_addr),
|
||||
host, hostlen);
|
||||
|
||||
if (!c)
|
||||
goto fail;
|
||||
};
|
||||
if (!c)
|
||||
goto fail;
|
||||
}
|
||||
break;
|
||||
|
||||
#if LOCAL
|
||||
case AF_LOCAL:
|
||||
if (!(flags & NI_NUMERICHOST)) {
|
||||
struct utsname utsname;
|
||||
if (!(flags & NI_NUMERICHOST))
|
||||
{
|
||||
struct utsname utsname;
|
||||
|
||||
if (!uname(&utsname)) {
|
||||
strncpy(host, utsname.nodename, hostlen);
|
||||
break;
|
||||
if (!uname (&utsname))
|
||||
{
|
||||
strncpy (host, utsname.nodename, hostlen);
|
||||
break;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
if (flags & NI_NAMEREQD)
|
||||
goto fail;
|
||||
|
||||
strncpy(host, "localhost", hostlen);
|
||||
strncpy (host, "localhost", hostlen);
|
||||
break;
|
||||
#endif /* LOCAL */
|
||||
|
||||
default:
|
||||
return -1;
|
||||
};
|
||||
}
|
||||
|
||||
if (serv && (servlen > 0))
|
||||
switch(sa->sa_family) {
|
||||
switch(sa->sa_family)
|
||||
{
|
||||
case AF_INET:
|
||||
#if INET6
|
||||
case AF_INET6:
|
||||
#endif /* INET6 */
|
||||
if (!(flags & NI_NUMERICSERV)) {
|
||||
struct servent *s, ts;
|
||||
while (__getservbyport_r(((struct sockaddr_in *)sa)->sin_port, ((flags & NI_DGRAM) ? "udp" : "tcp"), &ts, tmpbuf, tmpbuflen, &s)) {
|
||||
if (herrno == NETDB_INTERNAL) {
|
||||
if (errno == ERANGE) {
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
} else {
|
||||
goto fail;
|
||||
if (!(flags & NI_NUMERICSERV))
|
||||
{
|
||||
struct servent *s, ts;
|
||||
while (__getservbyport_r (((struct sockaddr_in *) sa)->sin_port,
|
||||
((flags & NI_DGRAM) ? "udp" : "tcp"),
|
||||
&ts, tmpbuf, tmpbuflen, &s))
|
||||
{
|
||||
if (herrno == NETDB_INTERNAL)
|
||||
{
|
||||
if (errno == ERANGE)
|
||||
{
|
||||
tmpbuflen *= 2;
|
||||
tmpbuf = __alloca(tmpbuflen);
|
||||
}
|
||||
else
|
||||
goto fail;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s)
|
||||
{
|
||||
strncpy(serv, s->s_name, servlen);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (s) {
|
||||
strncpy(serv, s->s_name, servlen);
|
||||
break;
|
||||
};
|
||||
};
|
||||
snprintf(serv, servlen, "%d", ntohs(((struct sockaddr_in *)sa)->sin_port));
|
||||
snprintf (serv, servlen, "%d",
|
||||
ntohs (((struct sockaddr_in *) sa)->sin_port));
|
||||
break;
|
||||
|
||||
#if LOCAL
|
||||
case AF_LOCAL:
|
||||
strncpy(serv, ((struct sockaddr_un *)sa)->sun_path, servlen);
|
||||
strncpy (serv, ((struct sockaddr_un *) sa)->sun_path, servlen);
|
||||
break;
|
||||
#endif /* LOCAL */
|
||||
};
|
||||
}
|
||||
|
||||
if (host && (hostlen > 0))
|
||||
host[hostlen-1] = 0;
|
||||
if (serv && (servlen > 0))
|
||||
|
@ -44,7 +44,7 @@
|
||||
#endif
|
||||
|
||||
/* Get libc version number. */
|
||||
#include "../../version.h"
|
||||
#include <version.h>
|
||||
|
||||
#define PACKAGE _libc_intl_domainname
|
||||
|
||||
@ -91,12 +91,12 @@ main (int argc, char *argv[])
|
||||
|
||||
/* Set the text message domain. */
|
||||
textdomain (PACKAGE);
|
||||
|
||||
|
||||
/* Initialize local variables. */
|
||||
debug = 0;
|
||||
do_help = 0;
|
||||
do_version = 0;
|
||||
|
||||
|
||||
while ((opt = getopt_long (argc, argv, "dhV", long_options, NULL)) != -1)
|
||||
switch (opt)
|
||||
{
|
||||
@ -119,12 +119,12 @@ main (int argc, char *argv[])
|
||||
if (do_version)
|
||||
{
|
||||
printf ("utmpd (GNU %s) %s\n", PACKAGE, VERSION);
|
||||
printf (gettext ("\
|
||||
printf (_("\
|
||||
Copyright (C) %s Free Software Foundation, Inc.\n\
|
||||
This is free software; see the source for copying conditions. There is NO\n\
|
||||
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
"), "1997");
|
||||
printf (gettext ("Written by %s.\n"), "Mark Kettenis");
|
||||
printf (_("Written by %s.\n"), "Mark Kettenis");
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
@ -136,7 +136,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
signal (SIGINT, termination_handler);
|
||||
signal (SIGQUIT, termination_handler);
|
||||
signal (SIGTERM, termination_handler);
|
||||
|
||||
|
||||
/* Check if we are already running. */
|
||||
if (check_pid (_PATH_UTMPDPID))
|
||||
error (EXIT_FAILURE, 0, _("already running"));
|
||||
@ -163,7 +163,7 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
if (!debug)
|
||||
{
|
||||
openlog ("utmpd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
|
||||
|
||||
|
||||
if (daemon (0, 0) < 0)
|
||||
error (EXIT_FAILURE, errno, _("cannot auto-background"));
|
||||
forked = 1;
|
||||
@ -176,10 +176,10 @@ warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\
|
||||
signal (SIGTTIN, SIG_IGN);
|
||||
signal (SIGTSTP, SIG_IGN);
|
||||
}
|
||||
|
||||
|
||||
/* Drop priviliges. */
|
||||
drop_priviliges ();
|
||||
|
||||
|
||||
/* Handle incoming requests. */
|
||||
handle_requests ();
|
||||
}
|
||||
@ -190,21 +190,21 @@ static void
|
||||
usage (int status)
|
||||
{
|
||||
if (status != EXIT_SUCCESS)
|
||||
fprintf (stderr, gettext ("Try `%s --help' for more information.\n"),
|
||||
fprintf (stderr, _("Try `%s --help' for more information.\n"),
|
||||
program_invocation_name);
|
||||
else
|
||||
{
|
||||
printf (gettext ("\
|
||||
printf (_("\
|
||||
Usage: %s [OPTION]...\n\
|
||||
-d, --debug do not fork and display messages on the current tty\n\
|
||||
-h, --help display this help and exit\n\
|
||||
-V, --version output version information and exit\n"),
|
||||
program_invocation_name);
|
||||
fputs (gettext ("\
|
||||
Report bugs to <kettenis@phys.uva.nl>.\n"),
|
||||
fputs (_("\
|
||||
Report bugs using the `glibcbug' script to <bugs@gnu.ai.mit.edu>.\n"),
|
||||
stdout);
|
||||
}
|
||||
|
||||
|
||||
exit (status);
|
||||
}
|
||||
|
||||
@ -247,10 +247,10 @@ make_socket (const char *name)
|
||||
terminating null byte. */
|
||||
size = (offsetof (struct sockaddr_un, sun_path)
|
||||
+ strlen (addr.sun_path));
|
||||
|
||||
|
||||
if (bind (sock, (struct sockaddr *) &addr, size) < 0)
|
||||
error (EXIT_FAILURE, errno, "%s", name);
|
||||
|
||||
|
||||
return sock;
|
||||
}
|
||||
|
||||
@ -265,7 +265,7 @@ void handle_requests (void)
|
||||
fd_set read_fd_set;
|
||||
fd_set write_fd_set;
|
||||
int fd;
|
||||
|
||||
|
||||
/* Initialize the set of active sockets. */
|
||||
FD_ZERO (&active_read_fd_set);
|
||||
FD_ZERO (&active_write_fd_set);
|
||||
@ -329,7 +329,7 @@ void handle_requests (void)
|
||||
if (connection->write_ptr == connection->write_base)
|
||||
FD_CLR (fd, &active_write_fd_set);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -344,7 +344,7 @@ termination_handler (int signum)
|
||||
|
||||
/* Restore user id. */
|
||||
seteuid (getuid ());
|
||||
|
||||
|
||||
/* Clean up the files created by `bind'. */
|
||||
unlink (_PATH_UTMPD_RO);
|
||||
unlink (_PATH_UTMPD_RW);
|
||||
@ -354,7 +354,7 @@ termination_handler (int signum)
|
||||
|
||||
/* Clean up pid file. */
|
||||
unlink (_PATH_UTMPDPID);
|
||||
|
||||
|
||||
exit (EXIT_SUCCESS);
|
||||
}
|
||||
|
||||
@ -364,12 +364,12 @@ static int
|
||||
check_pid (const char *file)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
|
||||
fp = fopen (_PATH_UTMPDPID, "r");
|
||||
if (fp)
|
||||
{
|
||||
pid_t pid;
|
||||
|
||||
|
||||
fscanf (fp, "%d", &pid);
|
||||
fclose (fp);
|
||||
|
||||
@ -386,17 +386,16 @@ static int
|
||||
write_pid (const char *file)
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
|
||||
fp = fopen (_PATH_UTMPDPID, "w");
|
||||
if (fp == NULL)
|
||||
return -1;
|
||||
|
||||
|
||||
fprintf (fp, "%d\n", getpid ());
|
||||
if (ferror (fp))
|
||||
return -1;
|
||||
|
||||
|
||||
fclose (fp);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
%% TeX macros to handle Texinfo files.
|
||||
%% $Id: texinfo.tex,v 2.208 1997/07/11 01:01:45 drepper Exp $
|
||||
%% $Id: texinfo.tex,v 2.209 1997/07/13 12:07:01 drepper Exp $
|
||||
|
||||
% Copyright (C) 1985, 86, 88, 90, 91, 92, 93,
|
||||
% 94, 95, 96, 97 Free Software Foundation, Inc.
|
||||
@ -36,7 +36,7 @@
|
||||
|
||||
% This automatically updates the version number based on RCS.
|
||||
\def\deftexinfoversion$#1: #2 ${\def\texinfoversion{#2}}
|
||||
\deftexinfoversion$Revision: 2.208 $
|
||||
\deftexinfoversion$Revision: 2.209 $
|
||||
\message{Loading texinfo package [Version \texinfoversion]:}
|
||||
|
||||
% If in a .fmt file, print the version number
|
||||
@ -1152,7 +1152,7 @@ where each line of input produces a line of output.}
|
||||
\setfont\titlesc\scbshape{10}{\magstep4}
|
||||
\font\titlei=cmmi12 scaled \magstep3
|
||||
\font\titlesy=cmsy10 scaled \magstep4
|
||||
\let\authorrm = \secrm
|
||||
\def\authorrm{\secrm}
|
||||
|
||||
% Chapter (and unnumbered) fonts (17.28pt).
|
||||
\setfont\chaprm\rmbshape{12}{\magstep2}
|
||||
|
@ -118,7 +118,7 @@ _nss_nisplus_parse_hostent (nis_result *result, int af, struct hostent *host,
|
||||
__set_errno (ERANGE);
|
||||
return 0;
|
||||
}
|
||||
p = stpcpy(p, " ");
|
||||
*p++ = ' ';
|
||||
p = stpncpy (p, NISENTRYVAL (i, 1, result),
|
||||
NISENTRYLEN (i, 1, result));
|
||||
*p = '\0';
|
||||
|
@ -89,7 +89,7 @@ _nss_nisplus_parse_netent (nis_result *result, struct netent *network,
|
||||
__set_errno (ERANGE);
|
||||
return 0;
|
||||
}
|
||||
p = stpcpy(p, " ");
|
||||
*p++ = ' ';
|
||||
p = stpncpy (p, NISENTRYVAL (i, 1, result),
|
||||
NISENTRYLEN (i, 1, result));
|
||||
*p = '\0';
|
||||
|
@ -85,7 +85,7 @@ _nss_nisplus_parse_protoent (nis_result * result, struct protoent *proto,
|
||||
{
|
||||
if (NISENTRYLEN (i, 1, result) + 2 > room_left)
|
||||
goto no_more_room;
|
||||
p = stpcpy(p, " ");
|
||||
*p++ = ' ';
|
||||
p = stpncpy (p, NISENTRYVAL (i, 1, result),
|
||||
NISENTRYLEN (i, 1, result));
|
||||
*p = '\0';
|
||||
|
@ -82,7 +82,7 @@ _nss_nisplus_parse_rpcent (nis_result *result, struct rpcent *rpc,
|
||||
{
|
||||
if (NISENTRYLEN (i, 1, result) + 2 > room_left)
|
||||
goto no_more_room;
|
||||
p = stpcpy(p, " ");
|
||||
*p++ = ' ';
|
||||
p = stpncpy (p, NISENTRYVAL (i, 1, result),
|
||||
NISENTRYLEN (i, 1, result));
|
||||
*p = '\0';
|
||||
|
@ -91,7 +91,7 @@ _nss_nisplus_parse_servent (nis_result *result, struct servent *serv,
|
||||
{
|
||||
if (NISENTRYLEN (i, 1, result) + 2 > room_left)
|
||||
goto no_more_room;
|
||||
p = stpcpy(p, " ");
|
||||
*p++ = ' ';
|
||||
p = stpncpy (p, NISENTRYVAL (i, 1, result),
|
||||
NISENTRYLEN (i, 1, result));
|
||||
*p = '\0';
|
||||
|
@ -18,7 +18,8 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#if defined (__GNUC__) && !defined (__NO_MATH_INLINES)
|
||||
#ifdef __GNUC__
|
||||
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
|
||||
|
||||
extern __inline double
|
||||
__copysign (double __x, double __y)
|
||||
@ -42,3 +43,4 @@ atan (double __x)
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
@ -21,9 +21,16 @@
|
||||
#endif
|
||||
|
||||
|
||||
/* This line MUST be split! Otherwise m4 will not change it. */
|
||||
#define __FD_ZERO(set) \
|
||||
((void) memset ((__ptr_t) (set), 0, sizeof (fd_set)))
|
||||
/* This line MUST be split! Otherwise m4 will not change it.
|
||||
|
||||
We don't use `memset' because this would require a prototype and
|
||||
the array isn't too big. */
|
||||
#define __FD_ZERO(set) \
|
||||
do { \
|
||||
unsigned int __i; \
|
||||
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
|
||||
((__fd_mask *) set)[__i] = '\0'; \
|
||||
} while (0)
|
||||
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
|
||||
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
|
||||
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
|
||||
|
@ -48,8 +48,14 @@
|
||||
|
||||
#else /* ! GNU CC */
|
||||
|
||||
/* We don't use `memset' because this would require a prototype and
|
||||
the array isn't too big. */
|
||||
#define __FD_ZERO(set) \
|
||||
((void) memset ((__ptr_t) (set), 0, sizeof (fd_set)))
|
||||
do { \
|
||||
unsigned int __i; \
|
||||
for (__i = 0; __i < sizeof (__fd_set) / sizeof (__fd_mask); ++__i) \
|
||||
((__fd_mask *) set)[__i] = '\0'; \
|
||||
} while (0)
|
||||
#define __FD_SET(d, set) ((set)->fds_bits[__FDELT(d)] |= __FDMASK(d))
|
||||
#define __FD_CLR(d, set) ((set)->fds_bits[__FDELT(d)] &= ~__FDMASK(d))
|
||||
#define __FD_ISSET(d, set) ((set)->fds_bits[__FDELT(d)] & __FDMASK(d))
|
||||
|
@ -21,7 +21,56 @@
|
||||
#ifndef _BITS_MATHINLINE_H
|
||||
#define _BITS_MATHINLINE_H 1
|
||||
|
||||
#if defined __GNUG__ && \
|
||||
|
||||
#if defined __USE_ISOC9X && defined __GNUC__ && __GNUC__ >= 2
|
||||
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||
ix87 FPU supports this with special opcodes and we should use them.
|
||||
These must not be inline functions since we have to be able to handle
|
||||
all floating-point types. */
|
||||
# define isgreater(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isgreaterequal(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isless(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;" \
|
||||
"setz %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define islessequal(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;" \
|
||||
"setz %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define islessgreater(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isunordered(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
#endif
|
||||
|
||||
|
||||
#if defined __GNUC__ && \
|
||||
(__GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ <= 7))
|
||||
/* gcc 2.7.2 and 2.7.2.1 have problems with inlining `long double'
|
||||
functions so we disable this now. */
|
||||
@ -29,8 +78,9 @@
|
||||
# define __NO_MATH_INLINES
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifndef __NO_MATH_INLINES
|
||||
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
|
||||
|
||||
#ifdef __cplusplus
|
||||
# define __MATH_INLINE __inline
|
||||
@ -258,10 +308,8 @@ __log2 (double __x)
|
||||
{
|
||||
register double __value;
|
||||
__asm __volatile__
|
||||
("fld1\n\t"
|
||||
"fxch\n\t"
|
||||
"fyl2x"
|
||||
: "=t" (__value) : "0" (__x));
|
||||
("fyl2x"
|
||||
: "=t" (__value) : "0" (__x), "u" (1.0));
|
||||
|
||||
return __value;
|
||||
}
|
||||
@ -441,7 +489,10 @@ logb (double __x)
|
||||
|
||||
return __value;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
__MATH_INLINE double drem (double __x, double __y);
|
||||
__MATH_INLINE double
|
||||
drem (double __x, double __y)
|
||||
@ -471,55 +522,6 @@ __finite (double __x)
|
||||
return __result;
|
||||
}
|
||||
|
||||
|
||||
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||
ix87 FPU supports this with special opcodes and we should use them.
|
||||
These must not be inline functions since we have to be able to handle
|
||||
all floating-point types. */
|
||||
# define isgreater(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; andb $0x45, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isgreaterequal(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; testb $0x05, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isless(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x45, %%ah;" \
|
||||
"setz %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define islessequal(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; xorb $0x01, %%ah; testb $0x05, %%ah;" \
|
||||
"setz %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define islessgreater(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; testb $0x44, %%ah; setz %%al;" \
|
||||
"andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
|
||||
# define isunordered(x, y) \
|
||||
({ int result; \
|
||||
__asm__ ("fucompp; fnstsw; sahf; setp %%al; andl $0xff, %0" \
|
||||
: "=a" (result) : "t" (x), "u" (y) : "cc"); \
|
||||
result; })
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __USE_MISC
|
||||
__MATH_INLINE double coshm1 (double __x);
|
||||
__MATH_INLINE double
|
||||
coshm1 (double __x)
|
||||
|
@ -19,18 +19,69 @@
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifdef __USE_ISOC9X
|
||||
|
||||
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||
m68k FPU supports this with special opcodes and we should use them.
|
||||
These must not be inline functions since we have to be able to handle
|
||||
all floating-point types. */
|
||||
# define isgreater(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsogt %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isgreaterequal(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsoge %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isless(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsolt %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define islessequal(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsole %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define islessgreater(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsogl %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isunordered(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsun %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
#endif
|
||||
|
||||
|
||||
#if (!defined __NO_MATH_INLINES && defined __OPTIMIZE__) \
|
||||
|| defined __LIBC_M81_MATH_INLINES
|
||||
|
||||
#ifdef __LIBC_M81_MATH_INLINES
|
||||
/* This is used when defining the functions themselves. Define them with
|
||||
__ names, and with `static inline' instead of `extern inline' so the
|
||||
bodies will always be used, never an external function call. */
|
||||
#define __m81_u(x) __CONCAT(__,x)
|
||||
#define __m81_inline static __inline
|
||||
# define __m81_u(x) __CONCAT(__,x)
|
||||
# define __m81_inline static __inline
|
||||
#else
|
||||
#define __m81_u(x) x
|
||||
#define __m81_inline extern __inline
|
||||
#define __M81_MATH_INLINES 1
|
||||
# define __m81_u(x) x
|
||||
# define __m81_inline extern __inline
|
||||
# define __M81_MATH_INLINES 1
|
||||
#endif
|
||||
|
||||
/* Define a const math function. */
|
||||
@ -385,55 +436,7 @@ __inline_forward(void,sincosl,
|
||||
#undef __inline_forward
|
||||
#undef __inline_forward_c
|
||||
|
||||
#ifdef __USE_ISOC9X
|
||||
|
||||
/* ISO C 9X defines some macros to perform unordered comparisons. The
|
||||
m68k FPU supports this with special opcodes and we should use them.
|
||||
These must not be inline functions since we have to be able to handle
|
||||
all floating-point types. */
|
||||
# define isgreater(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsogt %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isgreaterequal(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsoge %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isless(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsolt %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define islessequal(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsole %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define islessgreater(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsogl %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
|
||||
# define isunordered(x, y) \
|
||||
__extension__ \
|
||||
({ char __result; \
|
||||
__asm__ ("fcmp%.x %2,%1; fsun %0" \
|
||||
: "=dm" (__result) : "f" (x), "f" (y)); \
|
||||
(int) __result; })
|
||||
#endif
|
||||
|
||||
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
|
||||
|
||||
#endif
|
||||
#endif /* GCC. */
|
||||
|
@ -1 +1,3 @@
|
||||
wordsize-64
|
||||
# MIPS uses IEEE 754 floating point.
|
||||
ieee754
|
||||
|
@ -17,16 +17,13 @@
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#ifndef __MATH_H
|
||||
#define __MATH_H
|
||||
|
||||
#ifdef __GNUC__
|
||||
#ifndef __NO_MATH_INLINES
|
||||
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
|
||||
|
||||
#ifdef __cplusplus
|
||||
#define __MATH_INLINE __inline
|
||||
# define __MATH_INLINE __inline
|
||||
#else
|
||||
#define __MATH_INLINE extern __inline
|
||||
# define __MATH_INLINE extern __inline
|
||||
#endif
|
||||
|
||||
__MATH_INLINE double __sgn1 (double __x);
|
||||
@ -64,7 +61,5 @@ fabs (double __x)
|
||||
return __value;
|
||||
}
|
||||
|
||||
#endif /* __NO_MATH_INLINES */
|
||||
#endif /* __NO_MATH_INLINES && __OPTIMZE__ */
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
#endif /* __MATH_H */
|
||||
|
@ -1,26 +0,0 @@
|
||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
||||
Ported to standalone by Joel Sherrill jsherril@redstone-emh2.army.mil,
|
||||
On-Line Applications Research Corporation.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
#define L_tmpnam 1
|
||||
#define TMPMAX 0
|
||||
#define L_ctermid 1
|
||||
#define L_cuserid 1
|
||||
#define FOPEN_MAX 16
|
||||
#define FILENAME_MAX 14
|
@ -4,3 +4,9 @@
|
||||
|
||||
This file should define __MATH_INLINES if functions are actually defined as
|
||||
inlines. */
|
||||
|
||||
#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
|
||||
|
||||
/* Here goes the real code. */
|
||||
|
||||
#endif
|
||||
|
@ -1,4 +1,37 @@
|
||||
/* Copyright (C) 1994, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU Library General Public License as
|
||||
published by the Free Software Foundation; either version 2 of the
|
||||
License, or (at your option) any later version.
|
||||
|
||||
The GNU 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
|
||||
Library General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU Library General Public
|
||||
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
||||
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
||||
Boston, MA 02111-1307, USA. */
|
||||
|
||||
/* <bits/stdio_lim.h>: stdio limits for non-POSIX systems.
|
||||
* Never include this file directly; use <stdio.h> instead.
|
||||
*/
|
||||
|
||||
#ifndef _BITS_STDIO_LIM_H
|
||||
#define _BITS_STDIO_LIM_H
|
||||
|
||||
#define L_tmpnam 1
|
||||
#define TMPMAX 0
|
||||
#define TMP_MAX 0
|
||||
|
||||
#ifdef __USE_POSIX
|
||||
#define L_ctermid 1
|
||||
#define L_cuserid 1
|
||||
#endif
|
||||
|
||||
#define FOPEN_MAX 16
|
||||
#define FILENAME_MAX 14
|
||||
|
||||
#endif
|
||||
|
@ -13,6 +13,8 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h sys/mtio.h \
|
||||
sys/debugreg.h sys/kd.h sys/soundcard.h sys/vt.h \
|
||||
sys/quota.h
|
||||
|
||||
install-others += $(inst_includedir)/bits/syscall.h
|
||||
|
||||
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
|
||||
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
|
||||
rm -f $(@:.h=.d)
|
||||
@ -24,6 +26,13 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
|
||||
sed -n >> $(@:.d=.h).new \
|
||||
's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'
|
||||
mv -f $(@:.d=.h).new $(@:.d=.h)
|
||||
|
||||
$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h
|
||||
$(make-target-directory)
|
||||
if test -r $@ && cmp -s $< $@; \
|
||||
then echo 'bits/syscall.h unchanged'; \
|
||||
else $(INSTALL_DATA) $< $@; fi
|
||||
|
||||
ifndef no_deps
|
||||
# Get the generated list of dependencies (probably /usr/include/asm/unistd.h).
|
||||
-include $(objpfx)syscall-list.d
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* Copyright (C) 1995, 1996 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
|
||||
This file is part of the GNU C Library.
|
||||
|
||||
The GNU C Library is free software; you can redistribute it and/or
|
||||
@ -29,7 +29,7 @@
|
||||
programs expect the traditional form `SYS_<name>'. So in building libc
|
||||
we scan the kernel's list and produce <bits/syscall.h> with macros for
|
||||
all the `SYS_' names. */
|
||||
#include <bits/syscall.h>
|
||||
# include <bits/syscall.h>
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -424,15 +424,13 @@ strftime (s, maxsize, format, tp)
|
||||
const char *f;
|
||||
|
||||
zone = NULL;
|
||||
#if !defined _LIBC && HAVE_TM_ZONE
|
||||
/* XXX We have some problems here. First, the string pointed to by
|
||||
tm_zone is dynamically allocated while loading the zone data. But
|
||||
when another zone is loaded since the information in TP were
|
||||
computed this would be a stale pointer.
|
||||
The second problem is the POSIX test suite which assumes setting
|
||||
#if HAVE_TM_ZONE
|
||||
/* The POSIX test suite assumes that setting
|
||||
the environment variable TZ to a new value before calling strftime()
|
||||
will influence the result (the %Z format) even if the information in
|
||||
TP is computed with a totally different time zone. --drepper@gnu */
|
||||
TP is computed with a totally different time zone.
|
||||
This is bogus: though POSIX allows bad behavior like this,
|
||||
POSIX does not require it. Do the right thing instead. */
|
||||
zone = (const char *) tp->tm_zone;
|
||||
#endif
|
||||
#if HAVE_TZNAME
|
||||
|
@ -43,6 +43,8 @@ struct leap
|
||||
long int change; /* Seconds of correction to apply. */
|
||||
};
|
||||
|
||||
extern const char * __tzstring (const char *); /* Defined in tzset.c. */
|
||||
|
||||
static struct ttinfo *find_transition (time_t timer);
|
||||
static void compute_tzname_max (size_t);
|
||||
|
||||
@ -267,9 +269,9 @@ __tzfile_read (const char *file)
|
||||
info = find_transition (0);
|
||||
for (i = 0; i < num_types && i < sizeof (__tzname) / sizeof (__tzname[0]);
|
||||
++i)
|
||||
__tzname[types[i].isdst] = &zone_names[types[i].idx];
|
||||
__tzname[types[i].isdst] = __tzstring (&zone_names[types[i].idx]);
|
||||
if (info->isdst < sizeof (__tzname) / sizeof (__tzname[0]))
|
||||
__tzname[info->isdst] = &zone_names[info->idx];
|
||||
__tzname[info->isdst] = __tzstring (&zone_names[info->idx]);
|
||||
|
||||
compute_tzname_max (chars);
|
||||
|
||||
@ -285,7 +287,8 @@ __tzfile_read (const char *file)
|
||||
from the TZDEFRULES file. */
|
||||
|
||||
void
|
||||
__tzfile_default (char *std, char *dst, long int stdoff, long int dstoff)
|
||||
__tzfile_default (const char *std, const char *dst,
|
||||
long int stdoff, long int dstoff)
|
||||
{
|
||||
size_t stdlen, dstlen, i;
|
||||
long int rule_offset, rule_stdoff, rule_dstoff;
|
||||
@ -372,8 +375,8 @@ __tzfile_default (char *std, char *dst, long int stdoff, long int dstoff)
|
||||
types[1].isdst = 1;
|
||||
|
||||
/* Reset the zone names to point to the user's names. */
|
||||
__tzname[0] = &zone_names[0];
|
||||
__tzname[1] = &zone_names[stdlen];
|
||||
__tzname[0] = (char *) std;
|
||||
__tzname[1] = (char *) dst;
|
||||
|
||||
compute_tzname_max (stdlen + dstlen);
|
||||
}
|
||||
@ -455,7 +458,7 @@ __tzfile_compute (time_t timer, long int *leap_correct, int *leap_hit)
|
||||
void
|
||||
compute_tzname_max (size_t chars)
|
||||
{
|
||||
extern size_t __tzname_cur_max; /* Defined in __tzset.c. */
|
||||
extern size_t __tzname_cur_max; /* Defined in tzset.c. */
|
||||
|
||||
const char *p;
|
||||
|
||||
|
134
time/tzset.c
134
time/tzset.c
@ -31,8 +31,9 @@ extern const unsigned short int __mon_yday[2][13];
|
||||
|
||||
extern int __use_tzfile;
|
||||
extern void __tzfile_read __P ((const char *file));
|
||||
extern void __tzfile_default __P ((char *std, char *dst,
|
||||
extern void __tzfile_default __P ((const char *std, const char *dst,
|
||||
long int stdoff, long int dstoff));
|
||||
extern const char * __tzstring __P ((const char *string));
|
||||
extern int __tz_compute __P ((time_t timer, const struct tm *tm));
|
||||
|
||||
char *__tzname[2] = { (char *) "GMT", (char *) "GMT" };
|
||||
@ -53,7 +54,7 @@ weak_alias (__timezone, timezone)
|
||||
timezone given in the POSIX standard TZ envariable. */
|
||||
typedef struct
|
||||
{
|
||||
char *name;
|
||||
const char *name;
|
||||
|
||||
/* When to change. */
|
||||
enum { J0, J1, M } type; /* Interpretation of: */
|
||||
@ -74,6 +75,68 @@ static tz_rule tz_rules[2];
|
||||
|
||||
static int compute_change __P ((tz_rule *rule, int year));
|
||||
|
||||
/* Header for a list of buffers containing time zone strings. */
|
||||
struct tzstring_head
|
||||
{
|
||||
struct tzstring_head *next;
|
||||
/* The buffer itself immediately follows the header.
|
||||
The buffer contains zero or more (possibly overlapping) strings.
|
||||
The last string is followed by 2 '\0's instead of the usual 1. */
|
||||
};
|
||||
|
||||
/* First in a list of buffers containing time zone strings.
|
||||
All the buffers but the last are read-only. */
|
||||
static struct
|
||||
{
|
||||
struct tzstring_head head;
|
||||
char data[48];
|
||||
} tzstring_list;
|
||||
|
||||
/* Size of the last buffer in the list, not counting its header. */
|
||||
static size_t tzstring_last_buffer_size = sizeof tzstring_list.data;
|
||||
|
||||
/* Allocate a time zone string with given contents.
|
||||
The string will never be moved or deallocated.
|
||||
However, its contents may be shared with other such strings. */
|
||||
const char *
|
||||
__tzstring (string)
|
||||
const char *string;
|
||||
{
|
||||
struct tzstring_head *h = &tzstring_list.head;
|
||||
size_t needed;
|
||||
char *p;
|
||||
|
||||
/* Look through time zone string list for a duplicate of this one. */
|
||||
for (h = &tzstring_list.head; ; h = h->next)
|
||||
{
|
||||
for (p = (char *) (h + 1); p[0] | p[1]; p++)
|
||||
if (strcmp (p, string) == 0)
|
||||
return p;
|
||||
if (! h->next)
|
||||
break;
|
||||
}
|
||||
|
||||
/* No duplicate was found. Copy to the end of this buffer if there's room;
|
||||
otherwise, append a large-enough new buffer to the list and use it. */
|
||||
p++;
|
||||
needed = strlen (string) + 2; /* Need 2 trailing '\0's after last string. */
|
||||
|
||||
if ((size_t) ((char *) (h + 1) + tzstring_last_buffer_size - p) < needed)
|
||||
{
|
||||
size_t buffer_size = tzstring_last_buffer_size;
|
||||
while ((buffer_size *= 2) < needed)
|
||||
continue;
|
||||
if (! (h = h->next = malloc (sizeof *h + buffer_size)))
|
||||
return NULL;
|
||||
h->next = NULL;
|
||||
tzstring_last_buffer_size = buffer_size;
|
||||
p = (char *) (h + 1);
|
||||
}
|
||||
|
||||
strncpy (p, string, needed);
|
||||
return p;
|
||||
}
|
||||
|
||||
static char *old_tz = NULL;
|
||||
|
||||
/* Interpret the TZ envariable. */
|
||||
@ -85,6 +148,7 @@ __tzset_internal (always)
|
||||
static int is_initialized = 0;
|
||||
register const char *tz;
|
||||
register size_t l;
|
||||
char *tzbuf;
|
||||
unsigned short int hh, mm, ss;
|
||||
unsigned short int whichrule;
|
||||
|
||||
@ -112,12 +176,6 @@ __tzset_internal (always)
|
||||
/* No change, simply return. */
|
||||
return;
|
||||
|
||||
/* Free old storage. */
|
||||
if (tz_rules[0].name != NULL && *tz_rules[0].name != '\0')
|
||||
free ((void *) tz_rules[0].name);
|
||||
if (tz_rules[1].name != NULL && *tz_rules[1].name != '\0' &&
|
||||
tz_rules[1].name != tz_rules[0].name)
|
||||
free ((void *) tz_rules[1].name);
|
||||
tz_rules[0].name = NULL;
|
||||
tz_rules[1].name = NULL;
|
||||
|
||||
@ -135,16 +193,7 @@ __tzset_internal (always)
|
||||
|
||||
if (tz == NULL || *tz == '\0')
|
||||
{
|
||||
static const char UTC[] = "UTC";
|
||||
size_t len = sizeof UTC;
|
||||
tz_rules[0].name = (char *) malloc (len);
|
||||
if (tz_rules[0].name == NULL)
|
||||
return;
|
||||
tz_rules[1].name = (char *) malloc (len);
|
||||
if (tz_rules[1].name == NULL)
|
||||
return;
|
||||
memcpy ((void *) tz_rules[0].name, UTC, len);
|
||||
memcpy ((void *) tz_rules[1].name, UTC, len);
|
||||
tz_rules[0].name = tz_rules[1].name = "UTC";
|
||||
tz_rules[0].type = tz_rules[1].type = J0;
|
||||
tz_rules[0].m = tz_rules[0].n = tz_rules[0].d = 0;
|
||||
tz_rules[1].m = tz_rules[1].n = tz_rules[1].d = 0;
|
||||
@ -157,11 +206,11 @@ __tzset_internal (always)
|
||||
|
||||
/* Clear out old state and reset to unnamed UTC. */
|
||||
memset (tz_rules, 0, sizeof tz_rules);
|
||||
tz_rules[0].name = tz_rules[1].name = (char *) "";
|
||||
tz_rules[0].name = tz_rules[1].name = "";
|
||||
|
||||
/* Get the standard timezone name. */
|
||||
tz_rules[0].name = (char *) malloc (strlen (tz) + 1);
|
||||
if (tz_rules[0].name == NULL)
|
||||
tzbuf = malloc (strlen (tz) + 1);
|
||||
if (! tzbuf)
|
||||
{
|
||||
/* Clear the old tz name so we will try again. */
|
||||
free (old_tz);
|
||||
@ -169,25 +218,23 @@ __tzset_internal (always)
|
||||
return;
|
||||
}
|
||||
|
||||
if (sscanf (tz, "%[^0-9,+-]", tz_rules[0].name) != 1 ||
|
||||
(l = strlen(tz_rules[0].name)) < 3)
|
||||
if (sscanf (tz, "%[^0-9,+-]", tzbuf) != 1 ||
|
||||
(l = strlen (tzbuf)) < 3)
|
||||
{
|
||||
free (tz_rules[0].name);
|
||||
tz_rules[0].name = (char *) "";
|
||||
free (tzbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
{
|
||||
char *n = realloc ((void *) tz_rules[0].name, l + 1);
|
||||
if (n != NULL)
|
||||
tz_rules[0].name = n;
|
||||
}
|
||||
tz_rules[0].name = __tzstring (tzbuf);
|
||||
|
||||
tz += l;
|
||||
|
||||
/* Figure out the standard offset from UTC. */
|
||||
if (*tz == '\0' || (*tz != '+' && *tz != '-' && !isdigit (*tz)))
|
||||
return;
|
||||
{
|
||||
free (tzbuf);
|
||||
return;
|
||||
}
|
||||
|
||||
if (*tz == '-' || *tz == '+')
|
||||
tz_rules[0].offset = *tz++ == '-' ? 1L : -1L;
|
||||
@ -196,6 +243,7 @@ __tzset_internal (always)
|
||||
switch (sscanf (tz, "%hu:%hu:%hu", &hh, &mm, &ss))
|
||||
{
|
||||
default:
|
||||
free (tzbuf);
|
||||
return;
|
||||
case 1:
|
||||
mm = 0;
|
||||
@ -218,23 +266,14 @@ __tzset_internal (always)
|
||||
/* Get the DST timezone name (if any). */
|
||||
if (*tz != '\0')
|
||||
{
|
||||
char *n = malloc (strlen (tz) + 1);
|
||||
if (n != NULL)
|
||||
{
|
||||
tz_rules[1].name = n;
|
||||
if (sscanf (tz, "%[^0-9,+-]", tz_rules[1].name) != 1 ||
|
||||
(l = strlen (tz_rules[1].name)) < 3)
|
||||
{
|
||||
free (n);
|
||||
tz_rules[1].name = (char *) "";
|
||||
goto done_names; /* Punt on name, set up the offsets. */
|
||||
}
|
||||
n = realloc ((void *) tz_rules[1].name, l + 1);
|
||||
if (n != NULL)
|
||||
tz_rules[1].name = n;
|
||||
char *n = tzbuf + strlen (tzbuf) + 1;
|
||||
if (sscanf (tz, "%[^0-9,+-]", n) != 1 ||
|
||||
(l = strlen (n)) < 3)
|
||||
goto done_names; /* Punt on name, set up the offsets. */
|
||||
|
||||
tz += l;
|
||||
}
|
||||
tz_rules[1].name = __tzstring (n);
|
||||
|
||||
tz += l;
|
||||
|
||||
/* Figure out the DST offset from GMT. */
|
||||
if (*tz == '-' || *tz == '+')
|
||||
@ -271,6 +310,7 @@ __tzset_internal (always)
|
||||
tz_rules[1].name = tz_rules[0].name;
|
||||
|
||||
done_names:
|
||||
free (tzbuf);
|
||||
|
||||
if (*tz == '\0' || (tz[0] == ',' && tz[1] == '\0'))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user