From: JWP <elseifthen@gmx.com>
To: Karel Zak <kzak@redhat.com>
Cc: util-linux@vger.kernel.org
Subject: [PATCH 4/5] hwclock: Fix --date debug messages
Date: Thu, 23 Oct 2014 22:53:34 -0400 [thread overview]
Message-ID: <5449BF2E.7040604@gmx.com> (raw)
Fix --date debug messages with:
* Empty results for invalid arguments
* Empty lines(superfluous line breaks)
* Uncapitalized and missing words
* Inconsistent language
* Outdated message:
--date is now used for --predict so
'cannot set clock' makes no sense.
Signed-off-by: J William Piggott <elseifthen@gmx.com>
---
sys-utils/hwclock.c | 22 +++++++++-------------
1 file changed, 9 insertions(+), 13 deletions(-)
diff --git a/sys-utils/hwclock.c b/sys-utils/hwclock.c
index 3ad3791..6d05d46 100644
--- a/sys-utils/hwclock.c
+++ b/sys-utils/hwclock.c
@@ -765,15 +765,14 @@ static int interpret_date_string(const char *date_opt, time_t * const time_p)
}
if (!fgets(date_resp, sizeof(date_resp), date_child_fp))
- date_resp[0] = '\0'; /* in case fgets fails */
+ strcpy(date_resp, "NULL\n"); /* in case fgets fails */
if (debug)
- printf(_("response from date command = %s"), date_resp);
+ printf(_("The response was: %s"), date_resp);
if (strncmp(date_resp, magic, sizeof(magic) - 1) != 0) {
warnx(_("The date command issued by %s returned "
- "unexpected results\n"
- "The command was:\n %s\n"
- "The response was:\n %s"),
- program_invocation_short_name, date_command, date_resp);
+ "unexpected results\nThe response was: %s"
+ "The command was: %s"),
+ program_invocation_short_name, date_resp, date_command);
retcode = 8;
} else {
long seconds_since_epoch;
@@ -783,16 +782,14 @@ static int interpret_date_string(const char *date_opt, time_t * const time_p)
warnx(_("The date command issued by %s returned "
"something other\nthan an integer where the "
"converted time value was expected\n"
- "The command was:\n %s\n"
- "The response was:\n %s\n"),
- program_invocation_short_name, date_command,
- date_resp);
+ "The response was: %sThe command was: %s"),
+ program_invocation_short_name, date_resp, date_command);
retcode = 6;
} else {
retcode = 0;
*time_p = seconds_since_epoch;
if (debug)
- printf(_("date string %s equates to "
+ printf(_("The date string '%s' equates to:\n"
"%ld seconds since 1969\n"),
date_opt, (long)*time_p);
}
@@ -1905,8 +1902,7 @@ int main(int argc, char **argv)
rc = interpret_date_string(date_opt, &set_time);
/* (time-consuming) */
if (rc != 0) {
- warnx(_("No usable set-to time, "
- "cannot set clock"));
+ warnx(_("Invalid --date argument, see date(1)"));
hwclock_exit(EX_USAGE);
}
}
next reply other threads:[~2014-10-24 2:53 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-24 2:53 JWP [this message]
2014-10-24 11:41 ` [PATCH 4/5] hwclock: Fix --date debug messages Benno Schulenberg
2014-10-24 11:51 ` Benno Schulenberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5449BF2E.7040604@gmx.com \
--to=elseifthen@gmx.com \
--cc=kzak@redhat.com \
--cc=util-linux@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.