diff -rupN tzcode-2013e/Makefile tzcode-2013e-modified/Makefile --- tzcode-2013e/Makefile 2013-09-20 08:50:04.000000000 +0200 +++ tzcode-2013e-modified/Makefile 2013-09-25 11:30:42.688878224 +0200 @@ -113,6 +113,7 @@ LDLIBS= # -DHAVE_SETTIMEOFDAY=3 if settimeofday ignores 2nd arg (4.4BSD) # -DHAVE_STDINT_H=1 if you have a pre-C99 compiler with "stdint.h" # -DHAVE_SYMLINK=0 if your system lacks the symlink function +# -DHAVE_LINK=0 if your system lacks the link function # -DHAVE_SYS_STAT_H=0 if your compiler lacks a "sys/stat.h" # -DHAVE_SYS_WAIT_H=0 if your compiler lacks a "sys/wait.h" # -DHAVE_UNISTD_H=0 if your compiler lacks a "unistd.h" (Microsoft C++ 7?) @@ -299,8 +300,8 @@ CC= $(cc) -DTZDIR=\"$(TZDIR)\" TZCSRCS= zic.c localtime.c asctime.c scheck.c ialloc.c TZCOBJS= zic.o localtime.o asctime.o scheck.o ialloc.o -TZDSRCS= zdump.c localtime.c ialloc.c -TZDOBJS= zdump.o localtime.o ialloc.o +TZDSRCS= zdump.c localtime.c asctime.c ialloc.c +TZDOBJS= zdump.o localtime.o asctime.o ialloc.o DATESRCS= date.c localtime.c strftime.c asctime.c DATEOBJS= date.o localtime.o strftime.o asctime.o LIBSRCS= localtime.c asctime.c difftime.c diff -rupN tzcode-2013e/private.h tzcode-2013e-modified/private.h --- tzcode-2013e/private.h 2013-09-09 06:48:01.000000000 +0200 +++ tzcode-2013e-modified/private.h 2013-09-25 11:30:49.276878328 +0200 @@ -42,6 +42,10 @@ #define HAVE_SYMLINK 1 #endif /* !defined HAVE_SYMLINK */ +#ifndef HAVE_LINK +#define HAVE_LINK 1 +#endif /* !defined HAVE_LINK */ + #ifndef HAVE_SYS_STAT_H #define HAVE_SYS_STAT_H 1 #endif /* !defined HAVE_SYS_STAT_H */ diff -rupN tzcode-2013e/zic.c tzcode-2013e-modified/zic.c --- tzcode-2013e/zic.c 2013-09-16 06:22:33.000000000 +0200 +++ tzcode-2013e-modified/zic.c 2013-09-25 11:30:57.960878463 +0200 @@ -586,6 +586,52 @@ _("%s: More than one -L option specified return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE; } +#if !HAVE_LINK +#define SCRATCH_SIZE 8000 + +int +link(const char * fromname, const char * toname) +{ + FILE * fi; + FILE * fo; + char * scratch; + int err = 0; + + fi = fopen(fromname, "rb"); + if (!fi) return -1; + + fo = fopen(toname, "wb"); + if (!fo) { + fclose(fi); + return -1; + } + + scratch = (char*)emalloc(SCRATCH_SIZE); + while (!feof(fi)) { + int nread = fread(scratch, 1, SCRATCH_SIZE, fi); + if (nread > 0) { + int nwritten = fwrite(scratch, 1, nread, fo); + if (nwritten != nread) { + err = -1; + break; + } + } + else if (feof(fi)) { + break; + } + else if (ferror(fi)) { + err = -1; + break; + } + } + free(scratch); + fclose(fo); + fclose(fi); + + return err; +} +#endif /* !HAVE_LINK */ + static void dolink(const char *const fromfield, const char *const tofield) {