summaryrefslogtreecommitdiff
path: root/lib/libc/time/zic.c
diff options
context:
space:
mode:
authorDavid Leonard <d@cvs.openbsd.org>1999-07-01 23:05:40 +0000
committerDavid Leonard <d@cvs.openbsd.org>1999-07-01 23:05:40 +0000
commit6724b22af027e12e8d676e6eb2917d490c0d369a (patch)
treec0e2d8d6e18e27675d89f0c0fa7b03d68f1c3c13 /lib/libc/time/zic.c
parent011763372a00527c9c7006b783797df0cc724715 (diff)
tzcode1999d from ftp://elsie.nci.nih.gov/pub/; ok millert@
Diffstat (limited to 'lib/libc/time/zic.c')
-rw-r--r--lib/libc/time/zic.c26
1 files changed, 20 insertions, 6 deletions
diff --git a/lib/libc/time/zic.c b/lib/libc/time/zic.c
index a75d32f4af7..e385e71c87f 100644
--- a/lib/libc/time/zic.c
+++ b/lib/libc/time/zic.c
@@ -1,6 +1,6 @@
#if defined(LIBC_SCCS) && !defined(lint) && !defined(NOID)
-static char elsieid[] = "@(#)zic.c 7.96";
-static char rcsid[] = "$OpenBSD: zic.c,v 1.9 1999/01/29 07:04:05 d Exp $";
+static char elsieid[] = "@(#)zic.c 7.99";
+static char rcsid[] = "$OpenBSD: zic.c,v 1.10 1999/07/01 23:05:39 d Exp $";
#endif /* LIBC_SCCS and not lint */
#include "private.h"
@@ -562,12 +562,18 @@ _("%s: More than one -L option specified\n"),
/*
** Make links.
*/
- for (i = 0; i < nlinks; ++i)
+ for (i = 0; i < nlinks; ++i) {
+ eat(links[i].l_filename, links[i].l_linenum);
dolink(links[i].l_from, links[i].l_to);
- if (lcltime != NULL)
+ }
+ if (lcltime != NULL) {
+ eat("command line", 1);
dolink(lcltime, TZDEFAULT);
- if (psxrules != NULL)
+ }
+ if (psxrules != NULL) {
+ eat("command line", 1);
dolink(psxrules, TZDEFRULES);
+ }
return (errors == 0) ? EXIT_SUCCESS : EXIT_FAILURE;
}
@@ -604,12 +610,20 @@ const char * const tofile;
if (mkdirs(toname) != 0)
(void) exit(EXIT_FAILURE);
+
result = link(fromname, toname);
#if (HAVE_SYMLINK - 0)
if (result != 0) {
- result = symlink(fromname, toname);
+ char *s = (char *) tofile;
+ register char * symlinkcontents = NULL;
+ while ((s = strchr(s+1, '/')) != NULL)
+ symlinkcontents = ecatalloc(symlinkcontents, "../");
+ symlinkcontents = ecatalloc(symlinkcontents, fromfile);
+
+ result = symlink(symlinkcontents, toname);
if (result == 0)
warning(_("hard link failed, symbolic link used"));
+ ifree(symlinkcontents);
}
#endif
if (result != 0) {