Skip to contentSkip to conversation

hwclock: add -a that is short of --adjust to manual page and usage

PATCH In review Sami Kerola 2 participants 4 messages Sep 3, 2017 – Sep 5, 2017 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwclock: add -a that is short of --adjust to manual page and usage

In same go use -V as return value of --version from getopts_long().

---
 sys-utils/hwclock.8.in | 2 +-
 sys-utils/hwclock.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
sys-utils/hwclock.8.in +1 -1
index 107e3f196..2be7147e2 100644
@@ -34,7 +34,7 @@ was added.  See their respective descriptions below.
 The following functions are mutually exclusive, only one can be given at
 a time.  If none is given, the default is \fB\-\-show\fR.
 .TP
-.B \-\-adjust
+.B \-a, \-\-adjust
 Add or subtract time from the Hardware Clock to account for systematic
 drift since the last time the clock was set or adjusted.  See the
 discussion below, under
sys-utils/hwclock.c +2 -2
index 0b8444156..0da053617 100644
@@ -1089,7 +1089,7 @@ usage(const struct hwclock_control *ctl)
 	puts(_(" -s, --hctosys        set the system time from the RTC"));
 	puts(_(" -w, --systohc        set the RTC from the system time"));
 	puts(_("     --systz          send timescale configurations to the kernel"));
-	puts(_("     --adjust         adjust the RTC to account for systematic drift"));
+	puts(_(" -a, --adjust         adjust the RTC to account for systematic drift"));
 #if defined(__linux__) && defined(__alpha__)
 	puts(_("     --getepoch       display the RTC epoch"));
 	puts(_("     --setepoch       set the RTC epoch according to --epoch"));
@@ -1167,7 +1167,7 @@ int main(int argc, char **argv)
 		{ "show",         no_argument,       NULL, 'r'            },
 		{ "hctosys",      no_argument,       NULL, 's'            },
 		{ "utc",          no_argument,       NULL, 'u'            },
-		{ "version",      no_argument,       NULL, 'v'            },
+		{ "version",      no_argument,       NULL, 'V'            },
 		{ "systohc",      no_argument,       NULL, 'w'            },
 		{ "debug",        no_argument,       NULL, 'D'            },
 		{ "set",          no_argument,       NULL, OPT_SET        },
Signature · 1 line
2.14.1
maintainer
#1 lore raw
Quoted 13 lines · Sami Kerola

In same go use -V as return value of --version from getopts_long().

---
 sys-utils/hwclock.8.in | 2 +-
 sys-utils/hwclock.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
sys-utils/hwclock.8.in +0 -0
index 107e3f196..2be7147e2 100644

sys-utils/hwclock.8.in was added. See their respective descriptions below. · line 37

Quoted 5 lines
sys-utils/hwclock.8.in +1 -1
@@ -34,7 +34,7 @@ was added.  See their respective descriptions below.
 The following functions are mutually exclusive, only one can be given at
 a time.  If none is given, the default is \fB\-\-show\fR.
 .TP
-.B \-\-adjust
+.B \-a, \-\-adjust

Good idea.

Quoted 17 lines
sys-utils/hwclock.8.in +0 -0
 Add or subtract time from the Hardware Clock to account for systematic
 drift since the last time the clock was set or adjusted.  See the
 discussion below, under
sys-utils/hwclock.c +1 -1
index 0b8444156..0da053617 100644
@@ -1089,7 +1089,7 @@ usage(const struct hwclock_control *ctl)
 	puts(_(" -s, --hctosys        set the system time from the RTC"));
 	puts(_(" -w, --systohc        set the RTC from the system time"));
 	puts(_("     --systz          send timescale configurations to the kernel"));
-	puts(_("     --adjust         adjust the RTC to account for systematic drift"));
+	puts(_(" -a, --adjust         adjust the RTC to account for systematic drift"));
 #if defined(__linux__) && defined(__alpha__)
 	puts(_("     --getepoch       display the RTC epoch"));
 	puts(_("     --setepoch       set the RTC epoch according to --epoch"));

sys-utils/hwclock.c int main(int argc, char **argv) · line 1170

Quoted 5 lines
sys-utils/hwclock.c +1 -1
@@ -1167,7 +1167,7 @@ int main(int argc, char **argv)
 		{ "show",         no_argument,       NULL, 'r'            },
 		{ "hctosys",      no_argument,       NULL, 's'            },
 		{ "utc",          no_argument,       NULL, 'u'            },
-		{ "version",      no_argument,       NULL, 'v'            },
+		{ "version",      no_argument,       NULL, 'V'            },

What about backward compatibility? I can imagine script with "hwclock -v".

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com
#2 lore raw
Quoted 38 lines · Karel Zak
Quoted 13 lines · Sami Kerola

In same go use -V as return value of --version from getopts_long().

---
 sys-utils/hwclock.8.in | 2 +-
 sys-utils/hwclock.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
sys-utils/hwclock.8.in +0 -0
index 107e3f196..2be7147e2 100644

sys-utils/hwclock.8.in was added. See their respective descriptions below. · line 37

Quoted 5 lines
sys-utils/hwclock.8.in +1 -1
@@ -34,7 +34,7 @@ was added.  See their respective descriptions below.
 The following functions are mutually exclusive, only one can be given at
 a time.  If none is given, the default is \fB\-\-show\fR.
 .TP
-.B \-\-adjust
+.B \-a, \-\-adjust

Good idea.

Quoted 16 lines
sys-utils/hwclock.8.in +0 -0
 Add or subtract time from the Hardware Clock to account for systematic
 drift since the last time the clock was set or adjusted.  See the
 discussion below, under
sys-utils/hwclock.c +1 -1
index 0b8444156..0da053617 100644
@@ -1089,7 +1089,7 @@ usage(const struct hwclock_control *ctl)
      puts(_(" -s, --hctosys        set the system time from the RTC"));
      puts(_(" -w, --systohc        set the RTC from the system time"));
      puts(_("     --systz          send timescale configurations to the kernel"));
-     puts(_("     --adjust         adjust the RTC to account for systematic drift"));
+     puts(_(" -a, --adjust         adjust the RTC to account for systematic drift"));
 #if defined(__linux__) && defined(__alpha__)
      puts(_("     --getepoch       display the RTC epoch"));
      puts(_("     --setepoch       set the RTC epoch according to --epoch"));
Quoted 8 lines

sys-utils/hwclock.c int main(int argc, char **argv) · line 1170

Quoted 6 lines
sys-utils/hwclock.c +1 -1
@@ -1167,7 +1167,7 @@ int main(int argc, char **argv)
              { "show",         no_argument,       NULL, 'r'            },
              { "hctosys",      no_argument,       NULL, 's'            },
              { "utc",          no_argument,       NULL, 'u'            },
-             { "version",      no_argument,       NULL, 'v'            },
+             { "version",      no_argument,       NULL, 'V'            },

What about backward compatibility? I can imagine script with "hwclock -v".

I should have been more clear in commit message. Sorry about that.

Backward compatibility is taken care by getops_long() optstring and later case match:

https://github.com/karelzak/util-linux/blob/master/sys-utils/hwclock.c#L1212
https://github.com/karelzak/util-linux/blob/master/sys-utils/hwclock.c#L1299

I just wanted to sync long option conversion to short option to use 'V' rather than the
legacy 'v'. That is purely internal thing, and should not be observable in any manner.
You might ask why bother - and my explanation is that sticking to 'V' as 'version'
short hand everywhere is most obvious.

Signature · 2 lines
Sami Kerola
http://www.iki.fi/kerolasa/
maintainer
#3 lore raw
Quoted 9 lines · Sami Kerola
Quoted 4 lines

sys-utils/hwclock.c int main(int argc, char **argv) · line 1170

Quoted 2 lines
sys-utils/hwclock.c +1 -1
-             { "version",      no_argument,       NULL, 'v'            },
+             { "version",      no_argument,       NULL, 'V'            },

What about backward compatibility? I can imagine script with "hwclock -v".

I should have been more clear in commit message. Sorry about that.

Backward compatibility is taken care by getops_long() optstring and later case match:

Oh, I see. Sorry. Applied, thanks.

Karel

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com