Util-Linux package development
 help / color / mirror / Atom feed
From: Nick Erdmann <erdmann@date.upb.de>
To: util-linux@vger.kernel.org
Subject: [PATCH] ddate: St. Tib's Day in other languages
Date: Wed, 17 Aug 2011 20:35:02 +0200	[thread overview]
Message-ID: <1976757.PW98uZrV7g@arch> (raw)

In other languages than english, the translation of "St. Tib's Day" may not
be 13 bytes long. Example of what happens in german:
$ ddate 29 2 2008
St. Tib’s D, 3174 YOLD

Signed-off-by: Nick Erdmann <erdmann@date.upb.de>
--- a/misc-utils/ddate.c	2011-07-20 21:55:23.000000000 +0200
+++ b/misc-utils/ddate.c	2011-08-17 18:11:12.437504258 +0200
@@ -223,6 +223,7 @@
     int tib_start=-1, tib_end=0;
     int i, fmtlen=strlen(fmt);
     char *bufptr=buf;
+    char *foo;
 
 /*    fprintf(stderr, "format(%p, \"%s\", dt)\n", buf, fmt);*/
 
@@ -249,7 +250,9 @@
     for(i=0; i<fmtlen; i++) {
 	if((i==tib_start) && (dt.day==-1)) {
 	    /* handle St. Tib's Day */
-	    strcpy(bufptr, _("St. Tib's Day")); bufptr += 13;
+	    foo = _("St. Tib's Day");
+	    while((*bufptr++=*foo++));
+	    --bufptr;
 	    i=tib_end;
 	} else {
 	    if(fmt[i]=='%') {

             reply	other threads:[~2011-08-17 18:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-17 18:35 Nick Erdmann [this message]
2011-08-18  9:31 ` [PATCH] ddate: St. Tib's Day in other languages Karel Zak

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=1976757.PW98uZrV7g@arch \
    --to=erdmann@date.upb.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox