Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=fvbe.git;a=commitdiff;h=7a956e2a09fc571afd8bc85b463791c39ae51517

commit 7a956e2a09fc571afd8bc85b463791c39ae51517
Author: James Buren <[email protected]>
Date:   Fri Apr 5 10:51:20 2013 -0500

when setting up langconfig, remove reliance upon
sort and grep shell tools. perform these in our
C code instead. the shell output may change at
some point.

diff --git a/src/langconfig.c b/src/langconfig.c
index b747521..f9a6d58 100644
--- a/src/langconfig.c
+++ b/src/langconfig.c
@@ -45,8 +45,9 @@ static bool langconfig_setup(void)
size_t size = 4096;
char line[LINE_MAX] = {0};
char *locale = 0;
+  char *p = 0;

-  strfcpy(command,sizeof(command),"locale --all-locales | grep '\\.utf8$' | 
sort --unique");
+  strfcpy(command,sizeof(command),"locale --all-locales");

if((pipe = popen(command,"r")) == 0)
{
@@ -60,7 +61,9 @@ static bool langconfig_setup(void)
{
if(
i == size - 1                            ||
-      (locale = strtok(line,SPACE_CHARS)) == 0
+      (locale = strtok(line,SPACE_CHARS)) == 0 ||
+      (p = strstr(locale,".utf8")) == 0        ||
+      *p != 0
)
continue;

@@ -77,6 +80,8 @@ static bool langconfig_setup(void)
return false;
}

+  qsort(locales,i,sizeof(char *),charpp_qsort);
+
return true;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to