comparison compat.c @ 1109:1c24949cf853

Fixed a configure warning about datarootdir. (Just ignoring it for now) Upped the version number to 2.1 in configure.in and using autoconf 2.67. Fixed a pair of Linux/gcc warnings in the compat library.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Tue, 26 Jul 2011 20:35:05 +0000
parents 13debcad9757
children 404b639f096b
comparison
equal deleted inserted replaced
1108:772d4c692ea5 1109:1c24949cf853
687 free(locale_text); 687 free(locale_text);
688 locale_text = NULL; 688 locale_text = NULL;
689 } 689 }
690 } 690 }
691 691
692 void _stripcrlf(char *buf) 692 int _stripcrlf(char *buf)
693 { 693 {
694 int z, len = strlen(buf); 694 int z, len = strlen(buf);
695 695
696 for(z=0;z<len;z++) 696 for(z=0;z<len;z++)
697 { 697 {
698 if(buf[z] == '\r' || buf[z] == '\n') 698 if(buf[z] == '\r' || buf[z] == '\n')
699 { 699 {
700 buf[z] = 0; 700 buf[z] = 0;
701 return; 701 return 1;
702 } 702 }
703 } 703 }
704 return 1;
704 } 705 }
705 706
706 #ifdef __WIN32__ 707 #ifdef __WIN32__
707 #define LOCALE_CHARACTERS 62 708 #define LOCALE_CHARACTERS 62
708 static char locale_table[LOCALE_CHARACTERS * 2] = { 709 static char locale_table[LOCALE_CHARACTERS * 2] = {
744 745
745 _compat_free_locale(); 746 _compat_free_locale();
746 747
747 if(fp) 748 if(fp)
748 { 749 {
749 750 if(fgets(text, 1024, fp) && strncasecmp(text, "MESSAGES=", 9) == 0 && (count = atoi(&text[9])) > 0)
750 fgets(text, 1024, fp);
751 if(strncasecmp(text, "MESSAGES=", 9) == 0 && (count = atoi(&text[9])) > 0)
752 { 751 {
753 int current = -1; 752 int current = -1;
754 753
755 locale_text = calloc(count, sizeof(char *)); 754 locale_text = calloc(count, sizeof(char *));
756 755
757 while(!feof(fp)) 756 while(!feof(fp))
758 { 757 {
759 fgets(text, 1024, fp); 758 if(fgets(text, 1024, fp) && _stripcrlf(text) &&
760 _stripcrlf(text); 759 strncasecmp(text, "LOCALE=", 7) == 0)
761
762 if(strncasecmp(text, "LOCALE=", 7) == 0)
763 { 760 {
764 if(current > -1) 761 if(current > -1)
765 { 762 {
766 fclose(fp); 763 fclose(fp);
767 locale_count = count; 764 locale_count = count;