Util-Linux package development
 help / color / mirror / Atom feed
* [PATCH] ddate: St. Tib's Day in other languages
@ 2011-08-17 18:35 Nick Erdmann
  2011-08-18  9:31 ` Karel Zak
  0 siblings, 1 reply; 2+ messages in thread
From: Nick Erdmann @ 2011-08-17 18:35 UTC (permalink / raw)
  To: util-linux

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]=='%') {

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-08-18  9:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-08-17 18:35 [PATCH] ddate: St. Tib's Day in other languages Nick Erdmann
2011-08-18  9:31 ` Karel Zak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox