public inbox for linux-media@vger.kernel.org
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@redhat.com>
To: Linux Media Mailing List <linux-media@vger.kernel.org>
Cc: wk <handygewinnspiel@gmx.de>
Subject: [PATCH dvb-apps] Allow LANG/LC_TYPE with @ symbol
Date: Tue, 12 Apr 2011 20:49:39 -0300	[thread overview]
Message-ID: <4DA4E513.4090301@redhat.com> (raw)

According to IEEE Std 1003.1[1], the common way to specify LANG/LC_TYPE
is:
	language[_territory][.codeset]

However, a variant may also be used, like:
	[language[_territory][.codeset][@modifier]]

Change the logic to allow getting the charset also with the extended
syntax.

[1] http://pubs.opengroup.org/onlinepubs/009695399/basedefs/xbd_chap08.html

Thanks to Winfield <handygewinnspiel@gmx.de> for pointing it to me.

Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

diff --git a/util/scan/scan.c b/util/scan/scan.c
--- a/util/scan/scan.c
+++ b/util/scan/scan.c
@@ -2565,12 +2565,13 @@ int main (int argc, char **argv)
 	if ((charset = getenv("LC_ALL")) ||
 	    (charset = getenv("LC_CTYPE")) ||
 	    (charset = getenv ("LANG"))) {
-		while (*charset != '.' && *charset)
-			charset++;
-		if (*charset == '.')
-			charset++;
-		if (*charset)
-			output_charset = charset;
+		char *p = strchr(charset, '.');
+		if (p) {
+			p++;
+			p = strtok(p, "@");
+		}
+		if (p)
+			output_charset = p;
 		else
 			output_charset = nl_langinfo(CODESET);
 	} else

                 reply	other threads:[~2011-04-12 23:49 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=4DA4E513.4090301@redhat.com \
    --to=mchehab@redhat.com \
    --cc=handygewinnspiel@gmx.de \
    --cc=linux-media@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