[PATCH dvb-apps] Allow LANG/LC_TYPE with @ symbol

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx> for pointing it to me.

Signed-off-by: Mauro Carvalho Chehab <mchehab@xxxxxxxxxx>

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
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Input]     [Video for Linux]     [Gstreamer Embedded]     [Mplayer Users]     [Linux USB Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux