*** empty log message ***

Mon Feb 19 15:30:26 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* stdio-common/tstscanf.c (main): Add check for "0" as %d.

	* sysdeps/stub/msync.c: Undo change of Jan 29; just two args.
	Only some systems have three args; let them define their own stub.

	* sysdeps/generic/dl-sysdep.c: Declare _dl_secure.

	* sysdeps/generic/machine-gmon.h: New file.
	* gmon/Makefile (distribute): Add machine-gmon.h.
	* gmon/mcount.c: Undo changes of Feb 13.
	Include "machine-gmon.h".

Sun Feb 18 13:24:06 1996  Roland McGrath  <roland@charlie-brown.gnu.ai.mit.edu>

	* sysdeps/unix/sysv/linux/direct.h: File removed, since it is
	identical to unix/common/direct.h.

	* sysdeps/unix/Makefile [no_deps]: Don't include s-proto.d.

	* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Don't add ipc.

	* stdio-common/Makefile (tests): Remove scanf6.

	* sysdeps/unix/sysv/linux/Makefile (non-lib.a): Append libieee.a.

	* time/mktime.c (mktime): Move static variable localtime_offset to
	file scope.

	* stdio-common/vfscanf.c: Put '0' in buffer before scanning for %i
	base indicator.

Thu Feb 15 16:56:17 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Corrected.
	(ELF_MACHINE_BEFORE_RTLD_RELOC): Define.
	(_dl_runtime_resolve): Save %a1 as well.
	(ELF_MACHINE_RUNTIME_FIXUP_ARGS): Add second dummy arg.
	(elf_machine_relplt): Define.

	* elf/dl-runtime.c: Include possible extra args in declaration of
 	fixup.
This commit is contained in:
Roland McGrath 1996-02-19 20:54:38 +00:00
parent 1cbca0d93c
commit be10a86854
24 changed files with 248 additions and 137 deletions

View file

@ -1,3 +1,47 @@
Mon Feb 19 15:30:26 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* stdio-common/tstscanf.c (main): Add check for "0" as %d.
* sysdeps/stub/msync.c: Undo change of Jan 29; just two args.
Only some systems have three args; let them define their own stub.
* sysdeps/generic/dl-sysdep.c: Declare _dl_secure.
* sysdeps/generic/machine-gmon.h: New file.
* gmon/Makefile (distribute): Add machine-gmon.h.
* gmon/mcount.c: Undo changes of Feb 13.
Include "machine-gmon.h".
Sun Feb 18 13:24:06 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* sysdeps/unix/sysv/linux/direct.h: File removed, since it is
identical to unix/common/direct.h.
* sysdeps/unix/Makefile [no_deps]: Don't include s-proto.d.
* sysdeps/unix/sysv/linux/Makefile (sysdep_routines): Don't add ipc.
* stdio-common/Makefile (tests): Remove scanf6.
* sysdeps/unix/sysv/linux/Makefile (non-lib.a): Append libieee.a.
* time/mktime.c (mktime): Move static variable localtime_offset to
file scope.
* stdio-common/vfscanf.c: Put '0' in buffer before scanning for %i
base indicator.
Thu Feb 15 16:56:17 1996 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/m68k/dl-machine.h (elf_machine_load_address): Corrected.
(ELF_MACHINE_BEFORE_RTLD_RELOC): Define.
(_dl_runtime_resolve): Save %a1 as well.
(ELF_MACHINE_RUNTIME_FIXUP_ARGS): Add second dummy arg.
(elf_machine_relplt): Define.
* elf/dl-runtime.c: Include possible extra args in declaration of
fixup.
Fri Feb 16 11:01:59 1996 Roland McGrath <roland@charlie-brown.gnu.ai.mit.edu>
* time/tzset.c: Limit hours to 23, not 12. From jaffer.

View file

@ -1,6 +1,6 @@
# Make the TAGS files.
# Copyright (C) 1992, 1994, 1995 Free Software Foundation, Inc.
# Copyright (C) 1992, 1994, 1995, 1996 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
@ -98,7 +98,7 @@ ifdef subdir
ifdef tags_sources
$(ETAGS) -o $@ $^
else
# No sources. Create a dummy file.
# No sources. Create a dummy file.
touch $@
endif # tags_sources
else # parent
@ -114,3 +114,37 @@ $(subdirs:%=%/TAGS):
$(MAKE) -C $(@D) no_deps=t $(@F)
endif # subdir
XGETTEXT = xgettext
MSGJOIN = msgjoin
P = $(..)po
ifdef subdir
domain = $(subdir)
else
domain = libc-top
endif
define extract
@rm -f $@.new
$(XGETTEXT) --keyword=_ --keyword=N_ --sort-output -d - \
> $@.new /dev/null $^
mv -f $@.new $@
endef
$P/$(domain).pot: $(tags_sources); $(extract)
$P/siglist.pot: $(..)sysdeps/generic/signame.c; $(extract)
$P/errlist.pot: $(..)sysdeps/mach/hurd/errlist.c; $(extract)
ifndef subdir
$P/SYS_libc.pot: $P/libc-top.pot $(subdirs:%=$P/%.pot)
@rm -f $@.new
$(MSGJOIN) $^ > $@.new
mv -f $@.new $@
$(subdirs:%=$P/%.pot): $P/%.pot: FORCE
$(MAKE) -C $* no_deps=t ../$@
FORCE:
endif

View file

@ -621,6 +621,10 @@ check: tests
TAGS: distinfo $(..)MakeTAGS
$(MAKE) $(addprefix -f ,$^) $@
$(..)po/%.pot: distinfo $(..)MakeTAGS
$(MAKE) $(addprefix -f ,$^) $@
.PHONY: echo-headers
echo-headers:
@echo $(headers)

View file

@ -29,25 +29,8 @@ __BEGIN_DECLS
#include <gnu/types.h>
/* Directory entry structure.
This structure is laid out identically to the `struct direct' that
represents directory entries in the GNU Hurd and in BSD 4.4 (and
incidentally, on disk in the Berkeley fast file system). The `readdir'
implementations for GNU and BSD know this; you must change them if you
change this structure. */
struct dirent
{
__ino_t d_fileno; /* File serial number. */
unsigned short int d_reclen; /* Length of the whole `struct dirent'. */
unsigned char d_type; /* File type, possibly unknown. */
unsigned char d_namlen; /* Length of the file name. */
/* Only this member is in the POSIX standard. */
char d_name[1]; /* File name (actually longer). */
};
/* This file defines `struct dirent'. */
#include <direntry.h>
#if defined(__USE_BSD) || defined(__USE_MISC)
#define d_ino d_fileno /* Backward compatibility. */

View file

@ -37,7 +37,11 @@ Cambridge, MA 02139, USA. */
in the trampoline code will be a local PC-relative call. Tell the
compiler not to worry that the function appears not to be called. */
static Elf32_Addr fixup (struct link_map *l, Elf32_Word reloc_offset)
static Elf32_Addr fixup (
#ifdef ELF_MACHINE_RUNTIME_FIXUP_ARGS
ELF_MACHINE_RUNTIME_FIXUP_ARGS,
#endif
struct link_map *l, Elf32_Word reloc_offset)
__attribute__ ((unused));
/* This function is called through a special trampoline from the PLT the

View file

@ -31,9 +31,9 @@ CPPFLAGS += -D'GNULOCALEDIR="$(localedir)"' \
ifdef gettext-srcdir
%:: $(gettext-srcdir)/intl/%.glibc; $(copysrc)
%:: $(gettext-srcdir)/intl/%.c; $(copysrc)
%:: $(gettext-srcdir)/intl/%.h; $(copysrc)
%.h:: $(gettext-srcdir)/intl/%.glibc; $(copysrc)
%.c:: $(gettext-srcdir)/intl/%.c; $(copysrc)
%.h:: $(gettext-srcdir)/intl/%.h; $(copysrc)
define copysrc
cp -f $< $@.new

View file

@ -1,5 +1,5 @@
/* dcgettext.c -- implemenatation of the dcgettext(3) function
Copyright (C) 1995 Software Foundation, Inc.
/* dcgettext.c -- implementation of the dcgettext(3) function
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#ifdef __GNUC__
# define alloca __builtin_alloca
#else
# ifdef HAVE_ALLOCA_H || defined _LIBC
# if defined HAVE_ALLOCA_H || defined _LIBC
# include <alloca.h>
# else
# ifdef _AIX
@ -151,10 +151,11 @@ const char _nl_default_dirname[] = GNULOCALEDIR;
struct binding *_nl_domain_bindings;
/* Prototypes for local functions. */
static char *find_msg __P ((struct loaded_domain *domain, const char *msgid));
static const char *category_to_name __P((int category));
static const char *guess_category_value __P((int category,
const char *categoryname));
static char *find_msg PARAMS ((struct loaded_domain *domain,
const char *msgid));
static const char *category_to_name PARAMS ((int category));
static const char *guess_category_value PARAMS ((int category,
const char *categoryname));
/* Names for the libintl functions are a problem. They must not clash
@ -182,6 +183,7 @@ DCGETTEXT (domainname, msgid, category)
char *dirname, *xdomainname;
char *single_locale;
char *retval;
int saved_errno = errno;
/* If no real MSGID is given return NULL. */
if (msgid == NULL)
@ -233,9 +235,12 @@ DCGETTEXT (domainname, msgid, category)
}
if (ret == NULL)
/* We cannot get the current working directory. Don't signal an
error but simply return the default string. */
return (char *) msgid;
{
/* We cannot get the current working directory. Don't signal an
error but simply return the default string. */
errno = saved_errno;
return (char *) msgid;
}
/* We don't want libintl.a to depend on any other library. So
we avoid the non-standard function stpcpy. In GNU C Library
@ -302,7 +307,10 @@ DCGETTEXT (domainname, msgid, category)
domain. Return the MSGID. */
if (strcmp (single_locale, "C") == 0
|| strcmp (single_locale, "POSIX") == 0)
return (char *) msgid;
{
errno = saved_errno;
return (char *) msgid;
}
/* Find structure describing the message catalog matching the
@ -317,7 +325,7 @@ DCGETTEXT (domainname, msgid, category)
{
int cnt;
for (cnt = 0; domain->successor[cnt] != NULL; --cnt)
for (cnt = 0; domain->successor[cnt] != NULL; ++cnt)
{
retval = find_msg (domain->successor[cnt], msgid);
@ -327,7 +335,10 @@ DCGETTEXT (domainname, msgid, category)
}
if (retval != NULL)
return retval;
{
errno = saved_errno;
return retval;
}
}
}
/* NOTREACHED */
@ -375,8 +386,8 @@ find_msg (domain, msgid)
while (1)
{
if (idx >= W (domain->must_swap, domain->hash_size) - incr)
idx -= W (domain->must_swap, domain->hash_size) - incr;
if (idx >= domain->hash_size - incr)
idx -= domain->hash_size - incr;
else
idx += incr;

View file

@ -1,5 +1,5 @@
/* finddomain.c -- handle list of needed message catalogs
Copyright (C) 1995 Software Foundation, Inc.
Copyright (C) 1995 Free Software Foundation, Inc.
Written by Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
This program is free software; you can redistribute it and/or modify
@ -83,21 +83,21 @@ void free ();
static struct loaded_domain *_nl_loaded_domains;
/* Prototypes for local functions. */
static struct loaded_domain *make_entry_rec __P ((const char *dirname,
int mask,
const char *language,
const char *territory,
const char *codeset,
const char *modifier,
const char *special,
const char *sponsor,
const char *revision,
const char *domainname,
int do_allocate));
static struct loaded_domain *make_entry_rec PARAMS ((const char *dirname,
int mask,
const char *language,
const char *territory,
const char *codeset,
const char *modifier,
const char *special,
const char *sponsor,
const char *revision,
const char *domainname,
int do_allocate));
/* Substitution for systems lacking this function in their C library. */
#if !_LIBC && !HAVE_STPCPY
static char *stpcpy __P ((char *dest, const char *src));
static char *stpcpy PARAMS ((char *dest, const char *src));
#endif

View file

@ -1,5 +1,5 @@
/* gettextP.h -- header describing internals of gettext library
Copyright (C) 1995 Software Foundation, Inc.
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -20,11 +20,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* @@ end of prolog @@ */
#ifndef __P
#ifndef PARAMS
# if __STDC__
# define __P(args) args
# define PARAMS(args) args
# else
# define __P(args) ()
# define PARAMS(args) ()
# endif
#endif
@ -32,6 +32,9 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
# define W(flag, data) ((flag) ? SWAP (data) : (data))
#endif
static nls_uint32 SWAP PARAMS ((nls_uint32 i));
static inline nls_uint32
SWAP (i)
nls_uint32 i;
@ -64,12 +67,12 @@ struct binding
char *dirname;
};
struct loaded_domain *_nl_find_domain __P ((const char *__dirname,
char *__locale,
const char *__domainname));
void _nl_load_domain __P ((struct loaded_domain *__domain));
struct loaded_domain *_nl_find_domain PARAMS ((const char *__dirname,
char *__locale,
const char *__domainname));
void _nl_load_domain PARAMS ((struct loaded_domain *__domain));
const char *_nl_expand_alias __P ((const char *__name));
const char *_nl_expand_alias PARAMS ((const char *__name));
/* @@ begin of epilog @@ */

View file

@ -1,5 +1,5 @@
/* hash-string - Implements a string hashing function.
Copyright (C) 1995 Software Foundation, Inc.
Copyright (C) 1995 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -21,22 +21,28 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* @@ end of prolog @@ */
#ifndef BITSPERBYTE
# define BITSPERBYTE 8
#ifndef PARAMS
# if __STDC__
# define PARAMS(Args) Args
# else
# define PARAMS(Args) ()
# endif
#endif
#ifndef LONGBITS
# define LONGBITS (sizeof (long) * BITSPERBYTE)
#endif /* LONGBITS */
/* We assume to have `unsigned long int' value with at least 32 bits. */
#define HASHWORDBITS 32
/* Defines the so called `hashpjw' function by P.J. Weinberger
[see Aho/Sethi/Ullman, COMPILERS: Principles, Techniques and Tools,
1986, 1987 Bell Telephone Laboratories, Inc.] */
1986, 1987 Bell Telephone Laboratories, Inc.] */
static unsigned long hash_string PARAMS ((const char *__str_param));
static inline unsigned long
hash_string (str_param)
const char *str_param;
{
unsigned long hval, g;
unsigned long int hval, g;
const char *str = str_param;
/* Compute the hash value for the given string. */
@ -45,10 +51,10 @@ hash_string (str_param)
{
hval <<= 4;
hval += (unsigned long) *str++;
g = hval & ((unsigned long) 0xf << (LONGBITS - 4));
g = hval & ((unsigned long) 0xf << (HASHWORDBITS - 4));
if (g != 0)
{
hval ^= g >> (LONGBITS - 8);
hval ^= g >> (HASHWORDBITS - 8);
hval ^= g;
}
}

View file

@ -37,34 +37,36 @@ __BEGIN_DECLS
/* Look up MSGID in the current default message catalog for the current
LC_MESSAGES locale. If not found, returns MSGID itself (the default
text). */
extern char *gettext __P ((const char *__msgid));
extern char *__gettext __P ((const char *__msgid));
extern char *gettext __P ((__const char *__msgid));
extern char *__gettext __P ((__const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current
LC_MESSAGES locale. */
extern char *dgettext __P ((const char *__domainname, const char *__msgid));
extern char *__dgettext __P ((const char *__domainname, const char *__msgid));
extern char *dgettext __P ((__const char *__domainname,
__const char *__msgid));
extern char *__dgettext __P ((__const char *__domainname,
__const char *__msgid));
/* Look up MSGID in the DOMAINNAME message catalog for the current CATEGORY
locale. */
extern char *dcgettext __P ((const char *__domainname, const char *__msgid,
int __category));
extern char *__dcgettext __P ((const char *__domainname, const char *__msgid,
int __category));
extern char *dcgettext __P ((__const char *__domainname,
__const char *__msgid, int __category));
extern char *__dcgettext __P ((__const char *__domainname,
__const char *__msgid, int __category));
/* Set the current default message catalog to DOMAINNAME.
If DOMAINNAME is null, return the current default.
If DOMAINNAME is "", reset to the default of "messages". */
extern char *textdomain __P ((const char *__domainname));
extern char *__textdomain __P ((const char *__domainname));
extern char *textdomain __P ((__const char *__domainname));
extern char *__textdomain __P ((__const char *__domainname));
/* Specify that the DOMAINNAME message catalog will be found
in DIRNAME rather than in the system locale data base. */
extern char *bindtextdomain __P ((const char *__domainname,
const char *__dirname));
extern char *__bindtextdomain __P ((const char *__domainname,
const char *__dirname));
extern char *bindtextdomain __P ((__const char *__domainname,
__const char *__dirname));
extern char *__bindtextdomain __P ((__const char *__domainname,
__const char *__dirname));
/* Optimized version of the function above. */
@ -73,9 +75,9 @@ extern char *__bindtextdomain __P ((const char *__domainname,
`__builtin_constant_p' predicate in dcgettext would always return
false. */
# define gettext (msgid) dgettext (NULL, msgid)
# define gettext(msgid) dgettext (NULL, msgid)
# define dgettext (domainname, msgid) \
# define dgettext(domainname, msgid) \
dcgettext (domainname, msgid, LC_MESSAGES)
# if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)

View file

@ -1,5 +1,5 @@
/* localealias.c -- handle aliases for locale names
Copyright (C) 1995 Free Software Foundation, Inc.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@ -86,10 +86,10 @@ static size_t maxmap = 0;
/* Prototypes for local functions. */
static size_t read_alias_file __P ((const char *fname, int fname_len));
static void extend_alias_table __P ((void));
static int alias_compare __P ((const struct alias_map *map1,
const struct alias_map *map2));
static size_t read_alias_file PARAMS ((const char *fname, int fname_len));
static void extend_alias_table PARAMS ((void));
static int alias_compare PARAMS ((const struct alias_map *map1,
const struct alias_map *map2));
const char *
@ -109,9 +109,9 @@ _nl_expand_alias (name)
if (nmap > 0)
retval = (struct alias_map *) bsearch (&item, map, nmap,
sizeof (struct alias_map),
(int (*) (const void *,
const void *))
alias_compare);
(int (*) PARAMS ((const void *,
const void *))
) alias_compare);
else
retval = NULL;
@ -257,7 +257,7 @@ read_alias_file (fname, fname_len)
if (added > 0)
qsort (map, nmap, sizeof (struct alias_map),
(int (*) (const void *, const void *)) alias_compare);
(int (*) PARAMS ((const void *, const void *))) alias_compare);
return added;
}
@ -309,6 +309,8 @@ alias_compare (map1, map2)
c2 = isupper (*p2) ? tolower (*p2) : *p2;
if (c1 == '\0')
break;
++p1;
++p2;
}
while (c1 == c2);

View file

@ -1,6 +1,6 @@
# Makefile for the GNU C Library manual.
# Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
# Copyright (C) 1992, 1993, 1994, 1995, 1996 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
@ -148,7 +148,7 @@ ETAGS = etags -T
endif
TAGS: $(minimal-dist)
$(ETAGS) -o $@ $^
# These are targets that each glibc subdirectory is expected to understand.
# ../Rules defines them for code subdirectories; for us, they are no-ops.
glibc-targets := subdir_lib objects objs others tests subdir_lint.out \
@ -157,13 +157,13 @@ glibc-targets := subdir_lib objects objs others tests subdir_lint.out \
$(glibc-targets):
stubs: $(common-objpfx)stub-manual
$(common-objpfx)stub-manual:
$(common-objpfx)stub-manual ../po/manual.pot:
cp /dev/null $@
# The top-level glibc Makefile expects subdir_install to update the stubs file.
subdir_install: stubs
# Get rid of these variables if they came from the parent.
routines =
aux =

View file

@ -528,6 +528,7 @@ __vfscanf (FILE *s, const char *format, va_list argptr)
if (width > 0)
--width;
ADDW (c);
(void) inchar ();
if (width != 0 && tolower (c) == 'x')

View file

@ -23,7 +23,7 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h>
#ifdef MOTOROLA_SYNTAX
#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
#define d0 %d0
#define d1 %d1
#define PUSH(reg) move.l reg, -(%sp)

View file

@ -23,7 +23,7 @@ Cambridge, MA 02139, USA. */
#include <sysdep.h>
#ifdef MOTOROLA_SYNTAX
#if defined (MOTOROLA_SYNTAX) || defined (ELF_SYNTAX)
#define d0 %d0
#define d1 %d1
#define PUSH(reg) move.l reg, -(%sp)

View file

@ -52,9 +52,22 @@ elf_machine_got (void)
static inline Elf32_Addr
elf_machine_load_address (void)
{
...
Elf32_Addr addr;
asm ("here: lea here(%%pc), %0\n"
" sub.l %#here, %0"
: "=a" (addr));
return addr;
}
/* The `subl' insn above will contain an R_68K_RELATIVE relocation
entry intended to insert the run-time address of the label `here'.
This will be the first relocation in the text of the dynamic
linker; we skip it to avoid trying to modify read-only text in this
early stage. */
#define ELF_MACHINE_BEFORE_RTLD_RELOC(dynamic_info) \
((dynamic_info)[DT_RELA]->d_un.d_ptr += sizeof (Elf32_Rela), \
(dynamic_info)[DT_RELASZ]->d_un.d_val -= sizeof (Elf32_Rela))
/* Perform the relocation specified by RELOC and SYM (which is fully resolved).
MAP is the object containing the reloc. */
@ -158,11 +171,13 @@ elf_machine_runtime_setup (struct link_map *l, int lazy)
.globl _dl_runtime_resolve
.type _dl_runtime_resolve, @function
_dl_runtime_resolve:
| Save %a0 (struct return address).
| Save %a0 (struct return address) and %a1.
move.l %a0, -(%sp)
move.l %a1, -(%sp)
| Call the real address resolver.
bsr.l fixup
| Restore register %a0.
jbsr fixup
| Restore register %a0 and %a1.
move.l (%sp)+, %a1
move.l (%sp)+, %a0
| Pop parameters
addq.l #8, %sp
@ -170,7 +185,9 @@ _dl_runtime_resolve:
jmp (%d0)
.size _dl_runtime_resolve, . - _dl_runtime_resolve
");
#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0
#define ELF_MACHINE_RUNTIME_FIXUP_ARGS long int save_a0, long int save_a1
/* The PLT uses Elf32_Rela relocs. */
#define elf_machine_relplt elf_machine_rela
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1993, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1993, 1995, 1996 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
@ -37,9 +37,9 @@ DEFUN(closedir, (dirp), DIR *dirp)
return -1;
}
fd = dirp->__fd;
fd = dirp->fd;
free ((PTR) dirp->__data);
free ((PTR) dirp->data);
free ((PTR) dirp);
return __close (fd);

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1995, 1996 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
@ -20,8 +20,7 @@ Cambridge, MA 02139, USA. */
#define _DIRSTREAM_H 1
#define __need_size_t
#include <stddef.h>
#include <sys/types.h>
/* Directory stream type.
@ -37,7 +36,7 @@ struct __dirstream
size_t __offset; /* Current offset into the block. */
size_t __size; /* Total valid data in the block. */
struct dirent __entry; /* Returned by `readdir'. */
off_t pos; /* Position of next entry to read. */
};
#define _DIR_dirfd(dirp) ((dirp)->__fd)

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 93, 94, 95, 96 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
@ -16,7 +16,6 @@ License along with the GNU C Library; see the file COPYING.LIB. If
not, write to the Free Software Foundation, Inc., 675 Mass Ave,
Cambridge, MA 02139, USA. */
#include <ansidecl.h>
#include <errno.h>
#include <limits.h>
#include <stddef.h>
@ -28,12 +27,11 @@ Cambridge, MA 02139, USA. */
#include <unistd.h>
#include <stdio.h>
#include "direct.h" /* This file defines `struct direct'. */
#include "dirstream.h"
/* Open a directory stream on NAME. */
DIR *
DEFUN(opendir, (name), CONST char *name)
opendir (const char *name)
{
DIR *dirp;
struct stat statbuf;
@ -62,7 +60,7 @@ DEFUN(opendir, (name), CONST char *name)
goto lose;
}
dirp = (DIR *) calloc (1, sizeof (DIR) + NAME_MAX); /* Zero-fill. */
dirp = (DIR *) calloc (1, sizeof (DIR)); /* Zero-fill. */
if (dirp == NULL)
lose:
{
@ -73,24 +71,24 @@ DEFUN(opendir, (name), CONST char *name)
}
#ifdef _STATBUF_ST_BLKSIZE
if (statbuf.st_blksize < sizeof (struct direct))
dirp->__allocation = sizeof (struct direct);
if (statbuf.st_blksize < sizeof (struct dirent))
dirp->allocation = sizeof (struct dirent);
else
dirp->__allocation = statbuf.st_blksize;
dirp->allocation = statbuf.st_blksize;
#else
dirp->__allocation = (BUFSIZ < sizeof (struct direct) ?
sizeof (struct direct) : BUFSIZ);
dirp->allocation = (BUFSIZ < sizeof (struct dirent) ?
sizeof (struct dirent) : BUFSIZ);
#endif
dirp->__data = (char *) malloc (dirp->__allocation);
if (dirp->__data == NULL)
dirp->data = (char *) malloc (dirp->allocation);
if (dirp->data == NULL)
{
int save = errno;
free ((PTR) dirp);
free (dirp);
(void) __close (fd);
errno = save;
return NULL;
}
dirp->__fd = fd;
dirp->fd = fd;
return dirp;
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1993, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1991, 92, 93, 94, 95, 96 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
@ -77,6 +77,8 @@ DEFUN(readdir, (dirp), DIR *dirp)
p = memchr ((PTR) dp->d_name, '\0', D_NAMLEN (dp) + 1);
d->d_namlen = (p != NULL) ? p - dp->d_name : D_NAMLEN (dp);
memcpy (d->d_name, dp->d_name, d->d_namlen + 1);
d->d_type = DT_UNKNOWN;
d->d_reclen = &d->d_name[d->d_namlen + 1] - (char *) d;
return d;
}
}

View file

@ -27,7 +27,7 @@ Cambridge, MA 02139, USA. */
void
DEFUN(seekdir, (dirp, pos), DIR *dirp AND __off_t pos)
{
(void) __lseek(dirp->__fd, pos, SEEK_SET);
dirp->__size = 0;
dirp->__offset = 0;
(void) __lseek(dirp->fd, pos, SEEK_SET);
dirp->size = 0;
dirp->offset = 0;
}

View file

@ -36,8 +36,8 @@ DEFUN(telldir, (dirp), DIR *dirp)
return (off_t) -1;
}
pos = __lseek(dirp->__fd, (off_t) 0, SEEK_CUR);
pos = __lseek(dirp->fd, (off_t) 0, SEEK_CUR);
if (pos == (off_t) -1)
return (off_t) -1;
return pos + dirp->__size - dirp->__offset;
return pos + dirp->size - dirp->offset;
}

View file

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1994, 1995 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Contributed by Paul Eggert (eggert@twinsun.com).
This file is part of the GNU C Library.
@ -146,12 +146,13 @@ ydhms_tm_diff (year, yday, hour, min, sec, tp)
}
static time_t localtime_offset;
/* Convert *TP to a time_t value. */
time_t
mktime (tp)
struct tm *tp;
{
static time_t localtime_offset;
return __mktime_internal (tp, localtime_r, &localtime_offset);
}