95 lines
2.7 KiB
Diff
95 lines
2.7 KiB
Diff
From 180f76a2d41e1cea2895455f080f486b1d259279 Mon Sep 17 00:00:00 2001
|
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
Date: Fri, 12 Jun 2020 23:44:54 -0700
|
|
Subject: [PATCH 15/47] =?UTF-8?q?zic=20has=20new=20=E2=80=98-l=20-?=
|
|
=?UTF-8?q?=E2=80=99=20and=20=E2=80=98-p=20-=E2=80=99=20options?=
|
|
MIME-Version: 1.0
|
|
Content-Type: text/plain; charset=UTF-8
|
|
Content-Transfer-Encoding: 8bit
|
|
|
|
* NEWS, zic.8: Mention this.
|
|
* zic.c (dolink): If fromfield is "-", simply remove tofield.
|
|
---
|
|
NEWS | 3 +++
|
|
zic.8 | 12 ++++++++++++
|
|
zic.c | 5 ++++-
|
|
3 files changed, 19 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/NEWS b/NEWS
|
|
index 3bcddd0..cdcdbc1 100644
|
|
--- a/NEWS
|
|
+++ b/NEWS
|
|
@@ -23,6 +23,9 @@ Unreleased, experimental changes
|
|
|
|
Changes to code
|
|
|
|
+ zic's new '-l -' and '-p -' options uninstall any existing
|
|
+ localtime and posixrules files, respectively.
|
|
+
|
|
The undocumented and ineffective tzsetwall function has been
|
|
removed.
|
|
|
|
diff --git a/zic.8 b/zic.8
|
|
index b1bf437..a431311 100644
|
|
--- a/zic.8
|
|
+++ b/zic.8
|
|
@@ -85,6 +85,12 @@ will act as if the input contained a link line of the form
|
|
.ti +.5i
|
|
.ta \w'Link\0\0'u +\w'\fItimezone\fP\0\0'u
|
|
Link \fItimezone\fP localtime
|
|
+.sp
|
|
+If
|
|
+.I timezone
|
|
+is
|
|
+.BR \*- ,
|
|
+any already-existing link is removed.
|
|
.TP
|
|
.BI "\*-L " leapsecondfilename
|
|
Read leap second information from the file with the given name.
|
|
@@ -109,6 +115,12 @@ and it should not be combined with
|
|
if
|
|
.IR timezone 's
|
|
transitions are at standard time or Universal Time (UT) instead of local time.
|
|
+.sp
|
|
+If
|
|
+.I timezone
|
|
+is
|
|
+.BR \*- ,
|
|
+any already-existing link is removed.
|
|
.TP
|
|
.BR "\*-r " "[\fB@\fP\fIlo\fP][\fB/@\fP\fIhi\fP]"
|
|
Reduce the size of output files by limiting their applicability
|
|
diff --git a/zic.c b/zic.c
|
|
index 2875b55..c874b04 100644
|
|
--- a/zic.c
|
|
+++ b/zic.c
|
|
@@ -981,6 +981,7 @@ hardlinkerr(char const *from, char const *to)
|
|
static void
|
|
dolink(char const *fromfield, char const *tofield, bool staysymlink)
|
|
{
|
|
+ bool remove_only = strcmp(fromfield, "-") == 0;
|
|
bool todirs_made = false;
|
|
int link_errno;
|
|
|
|
@@ -988,7 +989,7 @@ dolink(char const *fromfield, char const *tofield, bool staysymlink)
|
|
** We get to be careful here since
|
|
** there's a fair chance of root running us.
|
|
*/
|
|
- if (itsdir(fromfield)) {
|
|
+ if (!remove_only && itsdir(fromfield)) {
|
|
fprintf(stderr, _("%s: link from %s/%s failed: %s\n"),
|
|
progname, directory, fromfield, strerror(EPERM));
|
|
exit(EXIT_FAILURE);
|
|
@@ -1003,6 +1004,8 @@ dolink(char const *fromfield, char const *tofield, bool staysymlink)
|
|
progname, directory, tofield, e);
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
+ if (remove_only)
|
|
+ return;
|
|
link_errno = staysymlink ? ENOTSUP : hardlinkerr(fromfield, tofield);
|
|
if (link_errno == ENOENT && !todirs_made) {
|
|
mkdirs(tofield, true);
|
|
--
|
|
1.8.3.1
|
|
|