zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Zsh workers <zsh-workers@sunsite.dk>
Subject: PATCH: langinfo module thinks October is January
Date: Fri, 30 May 2003 12:16:02 +0200	[thread overview]
Message-ID: <3021.1054289762@gmcs3.local> (raw)

I tried to use $langinfo to get the month names instead of typing them
out but it was printing January for October to December.

${(v)langinfo[(I)MON*]} correctly lists the months but try
$langinfo[MON_10] and you get January. The problem is caused by it
using strncmp to find the keys in the table and comparing the first
five characters of MON_1 with MON_10 matches. So $langinfo[MON_5wibble]
will also return May. With this patch, it just uses strcmp instead.

The termcap module seems to suffer from a similar problem (for both
echotc and the termcap association). Are all termcap codes two
characters? If so, I think we can just add a couple of
   if (strlen(s) != 2 )) return 1/NULL
I can't see how else termcap.c goes wrong (no strncmp) so I'm assuming
that it is tgetent that only looks at the first two characters.

Oliver

Index: Src/Modules/langinfo.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Modules/langinfo.c,v
retrieving revision 1.1
diff -u -r1.1 langinfo.c
--- Src/Modules/langinfo.c	19 Feb 2002 02:14:09 -0000	1.1
+++ Src/Modules/langinfo.c	30 May 2003 09:45:56 -0000
@@ -388,7 +388,7 @@
     nlcode = &nl_vals[0];
 
     for (element = (char **)nl_names; *element; element++, nlcode++) {
-	if ((!strncmp(*element, name, strlen(*element))))
+	if ((!strcmp(*element, name)))
 	    return nlcode;
     }
 


                 reply	other threads:[~2003-05-30 10:15 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=3021.1054289762@gmcs3.local \
    --to=okiddle@yahoo.co.uk \
    --cc=zsh-workers@sunsite.dk \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).