1998-05-20  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* Makeconfig (rpath-link): Add resolvobjdir.
	(resolvobjdir): New variable.
	Reported by Peter Breitenlohner <peb@mppmu.mpg.de> [fixes PR libc/633].

1998-05-20 09:36  Ulrich Drepper  <drepper@cygnus.com>

	* elf/dl-close.c: Call shared object terminators at the right time.
	Patch by Philippe Troin <phil@fifi.org>.

1998-05-20  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Make-dist (+tsrcs): Also add *.map for every member of
	$(extra-libs).

	* Makefile (distribute): Don't distribute scripts/printsources and
	scripts/=__ify.  Distribute FAQ.in.
	(rpm/%): Don't pass subdirs to sub-make.

	* timezone/Makefile: Protect inclusion of z.* by $(avoid-generated)
	instead of $(no_deps).

1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* sysdeps/generic/setenv.c: Protect against GNU C extension.
	(KNOWN_VALUE, STORE_VALUE): Do it right.
	(setenv): Remove unused variable.

1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* timezone/Makefile (tz-cflags): Define TM_GMTOFF and TM_ZONE.
	(CFLAGS-zdump.c): Add $(tz-cflags).

	* timezone/zdump.c (abbr): Use TM_ZONE if defined.  Add const to
	return type.

1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* time/tzfile.c (__tzfile_compute): Undo last change.  Instead
	take struct tm parameter and set tm_isdst, tm_zone and tm_offset
	if use_localtime.
	* time/tzset.c: Update prototype of __tzfile_compute.
	(__tz_convert): Pass tp to __tzfile_compute.  Don't set tm_isdst,
	tm_zone and tm_offset here if __use_tzfile.

1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules: Install libc.a even if there are no object file.

1998-05-18  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules (do-makelib): Don't force creating library from
	scratch, to avoid wasting time and space and to get correct
	behaviour if $(subdirs) is incomplete.

1998-05-19  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>

	* Makerules (do-stamp): Make it work when building in source
	directory.
This commit is contained in:
Ulrich Drepper 1998-05-20 10:50:03 +00:00
parent b0a01055eb
commit a709dd439a
11 changed files with 128 additions and 69 deletions

View File

@ -1,3 +1,64 @@
1998-05-20 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* Makeconfig (rpath-link): Add resolvobjdir.
(resolvobjdir): New variable.
Reported by Peter Breitenlohner <peb@mppmu.mpg.de> [fixes PR libc/633].
1998-05-20 09:36 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-close.c: Call shared object terminators at the right time.
Patch by Philippe Troin <phil@fifi.org>.
1998-05-20 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Make-dist (+tsrcs): Also add *.map for every member of
$(extra-libs).
* Makefile (distribute): Don't distribute scripts/printsources and
scripts/=__ify. Distribute FAQ.in.
(rpm/%): Don't pass subdirs to sub-make.
* timezone/Makefile: Protect inclusion of z.* by $(avoid-generated)
instead of $(no_deps).
1998-05-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* sysdeps/generic/setenv.c: Protect against GNU C extension.
(KNOWN_VALUE, STORE_VALUE): Do it right.
(setenv): Remove unused variable.
1998-05-18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* timezone/Makefile (tz-cflags): Define TM_GMTOFF and TM_ZONE.
(CFLAGS-zdump.c): Add $(tz-cflags).
* timezone/zdump.c (abbr): Use TM_ZONE if defined. Add const to
return type.
1998-05-18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* time/tzfile.c (__tzfile_compute): Undo last change. Instead
take struct tm parameter and set tm_isdst, tm_zone and tm_offset
if use_localtime.
* time/tzset.c: Update prototype of __tzfile_compute.
(__tz_convert): Pass tp to __tzfile_compute. Don't set tm_isdst,
tm_zone and tm_offset here if __use_tzfile.
1998-05-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makerules: Install libc.a even if there are no object file.
1998-05-18 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makerules (do-makelib): Don't force creating library from
scratch, to avoid wasting time and space and to get correct
behaviour if $(subdirs) is incomplete.
1998-05-19 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
* Makerules (do-stamp): Make it work when building in source
directory.
1998-05-20 00:10 Ulrich Drepper <drepper@cygnus.com> 1998-05-20 00:10 Ulrich Drepper <drepper@cygnus.com>
* elf/dl-load.c: Rename option and variable from ignore-rpath to * elf/dl-load.c: Rename option and variable from ignore-rpath to

View File

@ -122,7 +122,8 @@ sources := $(filter-out $(addsuffix .c,$(basename $(.S.s))),$(sources)) $(.S.s)
$(+subdir-nodist) $(dont_distribute) $(+subdir-nodist) $(dont_distribute)
foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2) foo:=$(shell echo '+out=$(+out)' >&2; echo foofoo >&2)
+tsrcs := $(filter-out $(+out), $(sources) $(all-headers) $(distribute)) \ +tsrcs := $(filter-out $(+out), $(sources) $(all-headers) $(distribute)) \
$(foreach l,$(extra-libs),$($l-map)) $(+sysdeps) $(foreach l,$(extra-libs),$($l-map)) \
$(wildcard $(addsuffix .map,$(extra-libs))) $(+sysdeps)
foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2) foo:=$(shell echo 'made +tsrcs=$(+tsrcs)'>&2)
foo:=$(shell echo generated='$(generated)' >&2) foo:=$(shell echo generated='$(generated)' >&2)
#generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c)) #generated := $(sort $(generated) $(generated:.S=.c) $(generated:.s=.c))

View File

@ -413,13 +413,14 @@ else
default-rpath = $(libdir) default-rpath = $(libdir)
endif endif
# This is how to find at build-time things that will be installed there. # This is how to find at build-time things that will be installed there.
rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir):$(rtobjdir) rpath-link = $(common-objdir):$(mathobjdir):$(elfobjdir):$(nssobjdir):$(nisobjdir):$(dbobjdir):$(rtobjdir):$(resolvobjdir)
mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math) mathobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)math)
elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf) elfobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)elf)
nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss) nssobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nss)
nisobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nis) nisobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)nis)
dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2) dbobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)db2)
rtobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)rt) rtobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)rt)
resolvobjdir := $(patsubst ../$(subdir),.,$(common-objpfx)resolv)
else else
link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a link-libc = $(common-objpfx)libc.a $(gnulib) $(common-objpfx)libc.a
endif endif

View File

@ -234,8 +234,8 @@ parent_echo-distinfo:
# Make the distribution tarfile. # Make the distribution tarfile.
distribute := README README.libm INSTALL FAQ NOTES NEWS PROJECTS \ distribute := README README.libm INSTALL FAQ FAQ.in NOTES NEWS BUGS \
BUGS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \ PROJECTS COPYING.LIB COPYING ChangeLog ChangeLog.[0-9] \
Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \ Makefile Makeconfig Makerules Rules Make-dist MakeTAGS \
extra-lib.mk o-iterator.mk libc.map configure \ extra-lib.mk o-iterator.mk libc.map configure \
configure.in aclocal.m4 config.h.in config.make.in \ configure.in aclocal.m4 config.h.in config.make.in \
@ -244,9 +244,9 @@ distribute := README README.libm INSTALL FAQ NOTES NEWS PROJECTS \
rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \ rpm/template rpm/rpmrc glibcbug.in abi-tags stub-tag.h \
test-skeleton.c include/des.h \ test-skeleton.c include/des.h \
$(addprefix scripts/, \ $(addprefix scripts/, \
rellns-sh config.sub config.guess printsources \ rellns-sh config.sub config.guess \
mkinstalldirs move-if-change install-sh =__ify \ mkinstalldirs move-if-change install-sh \
test-installation.pl gen-FAQ.pl) test-installation.pl gen-FAQ.pl)
distribute := $(strip $(distribute)) distribute := $(strip $(distribute))
generated := $(generated) stubs.h generated := $(generated) stubs.h
@ -270,7 +270,7 @@ endif
FORCE: FORCE:
rpm/%: subdir_distinfo rpm/%: subdir_distinfo
$(MAKE) $(PARALLELMFLAGS) -C $(@D) subdirs='$(subdirs)' $(@F) $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
iconvdata/%: iconvdata/%:
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F) $(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)

View File

@ -499,7 +499,7 @@ define o-iterator-doit
$(objpfx)stamp$o: $(o-objects); $$(do-stamp) $(objpfx)stamp$o: $(o-objects); $$(do-stamp)
endef endef
define do-stamp define do-stamp
echo '$(patsubst $(common-objpfx)%,%,$^)' > $@T echo '$(patsubst $(objpfx)%,$(addsuffix /,$(subdir))%,$^)' > $@T
mv -f $@T $@ mv -f $@T $@
endef endef
object-suffixes-left := $(object-suffixes-for-libc) object-suffixes-left := $(object-suffixes-for-libc)
@ -508,17 +508,15 @@ include $(o-iterator)
endif endif
# Now define explicit rules to build the library archives; these depend # Now define explicit rules to build the library archives; these depend
# on the stamp files built above. The rule always destroys and recreates # on the stamp files built above.
# the library from scratch; it's faster that way.
define o-iterator-doit define o-iterator-doit
$(common-objpfx)$(patsubst %,$(libtype$o),c): \ $(common-objpfx)$(patsubst %,$(libtype$o),c): \
$(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib) $(subdirs-stamp-o) $(common-objpfx)stamp$o; $$(do-makelib)
endef endef
define do-makelib define do-makelib
cd $(common-objdir) && \ cd $(common-objdir) && \
$(AR) $(CREATE_ARFLAGS) $(@F)T `cat $(patsubst $(common-objpfx)%,%,$^)` $(AR) $(CREATE_ARFLAGS) $(@F) `cat $(patsubst $(common-objpfx)%,%,$^)`
$(RANLIB) $@T $(RANLIB) $@
mv -f $@T $@
endef endef
subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%) subdirs-stamps := $(foreach d,$(subdirs),$(common-objpfx)$d/stamp%)
subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps)) subdirs-stamp-o = $(subst %,$o,$(subdirs-stamps))
@ -575,10 +573,8 @@ $(addprefix $(..)./scripts/mkinstalldirs ,\
$(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%))) $(filter-out $(wildcard $(@D:%/=%)),$(@D:%/=%)))
endef endef
# Any directory (parent or subdir) that has any object files to build # Any directory (parent or subdir) should install libc.a; this way
# should install libc.a; this way "make install" in a subdir is guaranteed # "make install" in a subdir is guaranteed to install everything it changes.
# to install everything it changes.
ifdef objects
installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\ installed-libcs := $(foreach o,$(filter-out .os,$(object-suffixes-for-libc)),\
$(inst_libdir)/$(patsubst %,$(libtype$o),\ $(inst_libdir)/$(patsubst %,$(libtype$o),\
$(libprefix)$(libc-name))) $(libprefix)$(libc-name)))
@ -589,7 +585,6 @@ $(installed-libcs): $(inst_libdir)/lib$(libprefix)%: lib $(+force)
# Running ranlib after installing makes the __.SYMDEF time stamp up to # Running ranlib after installing makes the __.SYMDEF time stamp up to
# date, which avoids messages from some linkers. # date, which avoids messages from some linkers.
$(RANLIB) $@ $(RANLIB) $@
endif
define do-install-program define do-install-program
$(make-target-directory) $(make-target-directory)

View File

@ -47,30 +47,39 @@ _dl_close (struct link_map *map)
__libc_lock_lock (_dl_load_lock); __libc_lock_lock (_dl_load_lock);
/* Decrement the reference count. */ /* Decrement the reference count. */
if (--map->l_opencount > 0 || map->l_type != lt_loaded) if (map->l_opencount > 1 || map->l_type != lt_loaded)
{ {
/* There are still references to this object. Do nothing more. */ /* There are still references to this object. Do nothing more. */
--map->l_opencount;
__libc_lock_unlock (_dl_load_lock); __libc_lock_unlock (_dl_load_lock);
return; return;
} }
list = map->l_searchlist;
/* Call all termination functions at once. */
for (i = 0; i < map->l_nsearchlist; ++i)
{
struct link_map *imap = list[i];
if (imap->l_opencount == 1 && imap->l_type == lt_loaded)
{
if (imap->l_info[DT_FINI])
/* Call its termination function. */
(*(void (*) (void)) ((void *) imap->l_addr
+ imap->l_info[DT_FINI]->d_un.d_ptr)) ();
}
}
/* Notify the debugger we are about to remove some loaded objects. */ /* Notify the debugger we are about to remove some loaded objects. */
_r_debug.r_state = RT_DELETE; _r_debug.r_state = RT_DELETE;
_dl_debug_state (); _dl_debug_state ();
list = map->l_searchlist;
/* The search list contains a counted reference to each object it /* The search list contains a counted reference to each object it
points to, the 0th elt being MAP itself. Decrement the reference points to, the 0th elt being MAP itself. Decrement the reference
counts on all the objects MAP depends on. */ counts on all the objects MAP depends on. */
for (i = 1; i < map->l_nsearchlist; ++i) for (i = 0; i < map->l_nsearchlist; ++i)
--list[i]->l_opencount; --list[i]->l_opencount;
/* Clear the search list so it doesn't get freed while we are still
using it. We have cached it in LIST and will free it when
finished. */
map->l_searchlist = NULL;
/* Check each element of the search list to see if all references to /* Check each element of the search list to see if all references to
it are gone. */ it are gone. */
for (i = 0; i < map->l_nsearchlist; ++i) for (i = 0; i < map->l_nsearchlist; ++i)
@ -84,11 +93,6 @@ _dl_close (struct link_map *map)
const ElfW(Phdr) *first, *last; const ElfW(Phdr) *first, *last;
ElfW(Addr) mapstart, mapend; ElfW(Addr) mapstart, mapend;
if (imap->l_info[DT_FINI])
/* Call its termination function. */
(*(void (*) (void)) ((void *) imap->l_addr +
imap->l_info[DT_FINI]->d_un.d_ptr)) ();
if (imap->l_global) if (imap->l_global)
{ {
/* This object is in the global scope list. Remove it. */ /* This object is in the global scope list. Remove it. */
@ -126,7 +130,7 @@ _dl_close (struct link_map *map)
imap->l_prev->l_next = imap->l_next; imap->l_prev->l_next = imap->l_next;
if (imap->l_next) if (imap->l_next)
imap->l_next->l_prev = imap->l_prev; imap->l_next->l_prev = imap->l_prev;
if (imap->l_searchlist) if (imap->l_searchlist && imap->l_searchlist != list)
free (imap->l_searchlist); free (imap->l_searchlist);
free (imap); free (imap);
} }

View File

@ -69,7 +69,8 @@ __libc_lock_define_initialized (static, envlock)
allow arbitrary many changes of the environment given that the used allow arbitrary many changes of the environment given that the used
values are from a small set. Outside glibc this will eat up all values are from a small set. Outside glibc this will eat up all
memory after a while. */ memory after a while. */
#if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH) #if defined _LIBC || (defined HAVE_SEARCH_H && defined HAVE_TSEARCH \
&& defined __GNUC__)
# define USE_TSEARCH 1 # define USE_TSEARCH 1
# include <search.h> # include <search.h>
@ -79,18 +80,11 @@ static void *known_values;
# define KNOWN_VALUE(Str) \ # define KNOWN_VALUE(Str) \
({ \ ({ \
void **value = tfind (Str, &known_values, (__compar_fn_t) strcmp); \ void *value = tfind (Str, &known_values, (__compar_fn_t) strcmp); \
if (value != NULL) \ value != NULL ? *(char **) value : NULL; \
value = *(const char **) value; \
value; \
}) })
# define STORE_VALUE(Str) \ # define STORE_VALUE(Str) \
({ \ tsearch (Str, &known_values, (__compar_fn_t) strcmp)
void **value = tsearch (Str, &known_values, (__compar_fn_t) strcmp); \
if (value != NULL) \
value = *(const char **) value; \
value; \
})
#else #else
# undef USE_TSEARCH # undef USE_TSEARCH
@ -186,7 +180,6 @@ setenv (name, value, replace)
} }
else if (replace) else if (replace)
{ {
size_t len = strlen (*ep);
char *new_value; char *new_value;
char *np; char *np;

View File

@ -415,13 +415,13 @@ find_transition (time_t timer)
int int
__tzfile_compute (time_t timer, int use_localtime, __tzfile_compute (time_t timer, int use_localtime,
long int *leap_correct, int *leap_hit, long int *leap_correct, int *leap_hit,
int *isdst, long int *offset) struct tm *tp)
{ {
struct ttinfo *info = find_transition (timer);
register size_t i; register size_t i;
if (use_localtime) if (use_localtime)
{ {
struct ttinfo *info = find_transition (timer);
__daylight = rule_stdoff != rule_dstoff; __daylight = rule_stdoff != rule_dstoff;
__timezone = -rule_stdoff; __timezone = -rule_stdoff;
__tzname[1] = NULL; __tzname[1] = NULL;
@ -432,11 +432,11 @@ __tzfile_compute (time_t timer, int use_localtime,
if (__tzname[1] == NULL) if (__tzname[1] == NULL)
/* There is no daylight saving time. */ /* There is no daylight saving time. */
__tzname[1] = __tzname[0]; __tzname[1] = __tzname[0];
tp->tm_isdst = info->isdst;
tp->tm_zone = &zone_names[info->idx];
tp->tm_gmtoff = info->offset;
} }
*isdst = info->isdst;
*offset = info->offset;
*leap_correct = 0L; *leap_correct = 0L;
*leap_hit = 0; *leap_hit = 0;

View File

@ -38,7 +38,7 @@ extern int __use_tzfile;
extern void __tzfile_read __P ((const char *file)); extern void __tzfile_read __P ((const char *file));
extern int __tzfile_compute __P ((time_t timer, int use_localtime, extern int __tzfile_compute __P ((time_t timer, int use_localtime,
long int *leap_correct, int *leap_hit, long int *leap_correct, int *leap_hit,
int *isdst, long int *offset)); struct tm *tp));
extern void __tzfile_default __P ((const char *std, const char *dst, extern void __tzfile_default __P ((const char *std, const char *dst,
long int stdoff, long int dstoff)); long int stdoff, long int dstoff));
extern char *__tzstring __P ((const char *string)); extern char *__tzstring __P ((const char *string));
@ -595,8 +595,6 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
{ {
long int leap_correction; long int leap_correction;
int leap_extra_secs; int leap_extra_secs;
int isdst;
long int offset;
if (timer == NULL) if (timer == NULL)
{ {
@ -615,8 +613,7 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
if (__use_tzfile) if (__use_tzfile)
{ {
if (! __tzfile_compute (*timer, use_localtime, if (! __tzfile_compute (*timer, use_localtime,
&leap_correction, &leap_extra_secs, &leap_correction, &leap_extra_secs, tp))
&isdst, &offset))
tp = NULL; tp = NULL;
} }
else else
@ -625,18 +622,20 @@ __tz_convert (const time_t *timer, int use_localtime, struct tm *tp)
tp = NULL; tp = NULL;
leap_correction = 0L; leap_correction = 0L;
leap_extra_secs = 0; leap_extra_secs = 0;
isdst = (*timer >= tz_rules[0].change && *timer < tz_rules[1].change);
offset = tz_rules[isdst].offset;
} }
if (tp) if (tp)
{ {
if (use_localtime) if (use_localtime)
{ {
tp->tm_isdst = isdst; if (!__use_tzfile)
tp->tm_zone = __tzname[isdst]; {
tp->tm_gmtoff = offset; int isdst = (*timer >= tz_rules[0].change
&& *timer < tz_rules[1].change);
tp->tm_isdst = isdst;
tp->tm_zone = __tzname[isdst];
tp->tm_gmtoff = tz_rules[isdst].offset;
}
} }
else else
{ {

View File

@ -53,7 +53,7 @@ define nl
endef endef
ifneq ($(no_deps),t) ifndef avoid-generated
-include $(addprefix $(objpfx)z.,$(tzfiles)) -include $(addprefix $(objpfx)z.,$(tzfiles))
endif endif
@ -158,9 +158,10 @@ $(objpfx)zic: $(objpfx)scheck.o $(objpfx)ialloc.o
tz-cflags = -DTZDIR='"$(zonedir)"' \ tz-cflags = -DTZDIR='"$(zonedir)"' \
-DTZDEFAULT='"$(localtime-file)"' \ -DTZDEFAULT='"$(localtime-file)"' \
-DTZDEFRULES='"$(posixrules-file)"' -DTZDEFRULES='"$(posixrules-file)"' \
-DTM_GMTOFF=tm_gmtoff -DTM_ZONE=tm_zone
CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID CFLAGS-zdump.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags) CFLAGS-zic.c = -Wno-strict-prototypes -DNOID $(tz-cflags)
CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID CFLAGS-ialloc.c = -Wno-strict-prototypes -DNOID
CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID CFLAGS-scheck.c = -Wno-strict-prototypes -DNOID

View File

@ -127,7 +127,7 @@ extern char * optarg;
extern int optind; extern int optind;
extern char * tzname[2]; extern char * tzname[2];
static char * abbr P((struct tm * tmp)); static const char *abbr P((struct tm * tmp));
static long delta P((struct tm * newp, struct tm * oldp)); static long delta P((struct tm * newp, struct tm * oldp));
static time_t hunt P((char * name, time_t lot, time_t hit)); static time_t hunt P((char * name, time_t lot, time_t hit));
static size_t longest; static size_t longest;
@ -358,15 +358,19 @@ int v;
(void) printf("\n"); (void) printf("\n");
} }
static char * static const char *
abbr(tmp) abbr(tmp)
struct tm * tmp; struct tm * tmp;
{ {
register char * result; register const char *result;
static char nada; static const char nada;
#ifdef TM_ZONE
result = tmp->TM_ZONE;
#else /* !defined TM_ZONE */
if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1) if (tmp->tm_isdst != 0 && tmp->tm_isdst != 1)
return &nada; return &nada;
result = tzname[tmp->tm_isdst]; result = tzname[tmp->tm_isdst];
#endif /* !defined TM_ZONE */
return (result == NULL) ? &nada : result; return (result == NULL) ? &nada : result;
} }