annotate libaudacious/rcfile.c @ 31:b1dcf238b2ba trunk

[svn] More AAC detection fixes c/o MSameer.
author nenolod
date Tue, 25 Oct 2005 22:09:36 -0700
parents cb178e5ad177
children 5bd743a3417b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
1 /* This program is free software; you can redistribute it and/or modify
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
2 * it under the terms of the GNU General Public License as published by
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
3 * the Free Software Foundation; either version 2 of the License, or
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
4 * (at your option) any later version.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
5 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
6 * This program is distributed in the hope that it will be useful,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
7 * but WITHOUT ANY WARRANTY; without even the implied warranty of
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
8 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
9 * GNU General Public License for more details.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
10 *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
11 * You should have received a copy of the GNU General Public License
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
12 * along with this program; if not, write to the Free Software
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
13 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
14 */
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
15
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
16 #include "rcfile.h"
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
17
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
18 #include <stdio.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
19 #include <string.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
20 #include <stdlib.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
21 #include <locale.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
22
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
23 #include <unistd.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
24 #include <sys/stat.h>
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
25
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
26
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
27 static RcSection *bmp_rcfile_create_section(RcFile * file,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
28 const gchar * name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
29 static RcLine *bmp_rcfile_create_string(RcSection * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
30 const gchar * key,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
31 const gchar * value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
32 static RcSection *bmp_rcfile_find_section(RcFile * file, const gchar * name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
33 static RcLine *bmp_rcfile_find_string(RcSection * section, const gchar * key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
34
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
35
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
36 RcFile *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
37 bmp_rcfile_new(void)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
38 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
39 return g_new0(RcFile, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
40 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
41
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
42 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
43 bmp_rcfile_free(RcFile * file)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
44 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
45 RcSection *section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
46 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
47 GList *section_list, *line_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
48
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
49 if (file == NULL)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
50 return;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
51
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
52 section_list = file->sections;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
53 while (section_list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
54 section = (RcSection *) section_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
55 g_free(section->name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
56
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
57 line_list = section->lines;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
58 while (line_list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
59 line = (RcLine *) line_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
60 g_free(line->key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
61 g_free(line->value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
62 g_free(line);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
63 line_list = g_list_next(line_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
64 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
65 g_list_free(section->lines);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
66 g_free(section);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
67
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
68 section_list = g_list_next(section_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
69 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
70 g_list_free(file->sections);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
71 g_free(file);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
72 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
73
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
74 RcFile *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
75 bmp_rcfile_open(const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
76 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
77 RcFile *file;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
78
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
79 gchar *buffer, **lines, *tmp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
80 gint i;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
81 RcSection *section = NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
82
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
83 g_return_val_if_fail(filename != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
84 g_return_val_if_fail(strlen(filename) > 0, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
85
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
86 if (!g_file_get_contents(filename, &buffer, NULL, NULL))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
87 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
88
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
89 file = g_malloc0(sizeof(RcFile));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
90 lines = g_strsplit(buffer, "\n", 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
91 g_free(buffer);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
92 i = 0;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
93 while (lines[i]) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
94 if (lines[i][0] == '[') {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
95 if ((tmp = strchr(lines[i], ']'))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
96 *tmp = '\0';
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
97 section = bmp_rcfile_create_section(file, &lines[i][1]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
98 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
99 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
100 else if (lines[i][0] != '#' && section) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
101 if ((tmp = strchr(lines[i], '='))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
102 gchar **frags;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
103 frags = g_strsplit(lines[i], "=", 0);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
104 if (strlen(frags[1]) > 0) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
105 bmp_rcfile_create_string(section, frags[0], frags[1]);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
106 };
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
107 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
108 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
109 i++;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
110 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
111 g_strfreev(lines);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
112 return file;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
113 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
114
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
115 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
116 bmp_rcfile_write(RcFile * file, const gchar * filename)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
117 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
118 FILE *fp;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
119 GList *section_list, *line_list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
120 RcSection *section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
121 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
122
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
123 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
124 g_return_val_if_fail(filename != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
125
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
126 if (!(fp = fopen(filename, "w")))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
127 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
128
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
129 section_list = file->sections;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
130 while (section_list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
131 section = (RcSection *) section_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
132 if (section->lines) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
133 fprintf(fp, "[%s]\n", section->name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
134 line_list = section->lines;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
135 while (line_list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
136 line = (RcLine *) line_list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
137 fprintf(fp, "%s=%s\n", line->key, line->value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
138 line_list = g_list_next(line_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
139 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
140 fprintf(fp, "\n");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
141 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
142 section_list = g_list_next(section_list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
143 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
144 fclose(fp);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
145 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
146 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
147
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
148 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
149 bmp_rcfile_read_string(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
150 const gchar * key, gchar ** value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
151 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
152 RcSection *sect;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
153 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
154
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
155 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
156 g_return_val_if_fail(section != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
157 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
158 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
159
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
160 if (!(sect = bmp_rcfile_find_section(file, section)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
161 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
162 if (!(line = bmp_rcfile_find_string(sect, key)))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
163 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
164 *value = g_strdup(line->value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
165 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
166 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
167
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
168 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
169 bmp_rcfile_read_int(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
170 const gchar * key, gint * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
171 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
172 gchar *str;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
173
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
174 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
175 g_return_val_if_fail(section != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
176 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
177 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
178
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
179 if (!bmp_rcfile_read_string(file, section, key, &str))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
180 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
181 *value = atoi(str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
182 g_free(str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
183
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
184 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
185 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
186
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
187 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
188 bmp_rcfile_read_bool(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
189 const gchar * key, gboolean * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
190 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
191 gchar *str;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
192
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
193 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
194 g_return_val_if_fail(section != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
195 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
196 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
197
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
198 if (!bmp_rcfile_read_string(file, section, key, &str))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
199 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
200 if (!strcasecmp(str, "TRUE"))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
201 *value = TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
202 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
203 *value = FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
204 g_free(str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
205 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
206 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
207
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
208 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
209 bmp_rcfile_read_float(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
210 const gchar * key, gfloat * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
211 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
212 gchar *str, *locale;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
213
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
214 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
215 g_return_val_if_fail(section != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
216 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
217 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
218
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
219 if (!bmp_rcfile_read_string(file, section, key, &str))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
220 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
221
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
222 locale = g_strdup(setlocale(LC_NUMERIC, NULL));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
223 setlocale(LC_NUMERIC, "C");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
224 *value = strtod(str, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
225 setlocale(LC_NUMERIC, locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
226 g_free(locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
227 g_free(str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
228
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
229 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
230 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
231
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
232 gboolean
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
233 bmp_rcfile_read_double(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
234 const gchar * key, gdouble * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
235 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
236 gchar *str, *locale;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
237
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
238 g_return_val_if_fail(file != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
239 g_return_val_if_fail(section != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
240 g_return_val_if_fail(key != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
241 g_return_val_if_fail(value != NULL, FALSE);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
242
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
243 if (!bmp_rcfile_read_string(file, section, key, &str))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
244 return FALSE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
245
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
246 locale = g_strdup(setlocale(LC_NUMERIC, NULL));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
247 setlocale(LC_NUMERIC, "C");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
248 *value = strtod(str, NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
249 setlocale(LC_NUMERIC, locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
250 g_free(locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
251 g_free(str);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
252
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
253 return TRUE;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
254 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
255
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
256 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
257 bmp_rcfile_write_string(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
258 const gchar * key, const gchar * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
259 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
260 RcSection *sect;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
261 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
262
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
263 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
264 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
265 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
266 g_return_if_fail(value != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
267
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
268 sect = bmp_rcfile_find_section(file, section);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
269 if (!sect)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
270 sect = bmp_rcfile_create_section(file, section);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
271 if ((line = bmp_rcfile_find_string(sect, key))) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
272 g_free(line->value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
273 line->value = g_strstrip(g_strdup(value));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
274 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
275 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
276 bmp_rcfile_create_string(sect, key, value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
277 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
278
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
279 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
280 bmp_rcfile_write_int(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
281 const gchar * key, gint value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
282 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
283 gchar *strvalue;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
284
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
285 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
286 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
287 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
288
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
289 strvalue = g_strdup_printf("%d", value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
290 bmp_rcfile_write_string(file, section, key, strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
291 g_free(strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
292 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
293
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
294 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
295 bmp_rcfile_write_boolean(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
296 const gchar * key, gboolean value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
297 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
298 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
299 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
300 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
301
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
302 if (value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
303 bmp_rcfile_write_string(file, section, key, "TRUE");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
304 else
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
305 bmp_rcfile_write_string(file, section, key, "FALSE");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
306 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
307
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
308 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
309 bmp_rcfile_write_float(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
310 const gchar * key, gfloat value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
311 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
312 gchar *strvalue, *locale;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
313
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
314 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
315 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
316 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
317
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
318 locale = g_strdup(setlocale(LC_NUMERIC, NULL));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
319 setlocale(LC_NUMERIC, "C");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
320 strvalue = g_strdup_printf("%g", value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
321 setlocale(LC_NUMERIC, locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
322 bmp_rcfile_write_string(file, section, key, strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
323 g_free(locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
324 g_free(strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
325 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
326
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
327 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
328 bmp_rcfile_write_double(RcFile * file, const gchar * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
329 const gchar * key, gdouble value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
330 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
331 gchar *strvalue, *locale;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
332
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
333 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
334 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
335 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
336
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
337 locale = g_strdup(setlocale(LC_NUMERIC, NULL));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
338 setlocale(LC_NUMERIC, "C");
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
339 strvalue = g_strdup_printf("%g", value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
340 setlocale(LC_NUMERIC, locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
341 bmp_rcfile_write_string(file, section, key, strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
342 g_free(locale);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
343 g_free(strvalue);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
344 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
345
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
346 void
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
347 bmp_rcfile_remove_key(RcFile * file, const gchar * section, const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
348 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
349 RcSection *sect;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
350 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
351
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
352 g_return_if_fail(file != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
353 g_return_if_fail(section != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
354 g_return_if_fail(key != NULL);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
355
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
356 if ((sect = bmp_rcfile_find_section(file, section)) != NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
357 if ((line = bmp_rcfile_find_string(sect, key)) != NULL) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
358 g_free(line->key);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
359 g_free(line->value);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
360 g_free(line);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
361 sect->lines = g_list_remove(sect->lines, line);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
362 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
363 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
364 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
365
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
366 static RcSection *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
367 bmp_rcfile_create_section(RcFile * file, const gchar * name)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
368 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
369 RcSection *section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
370
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
371 section = g_new0(RcSection, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
372 section->name = g_strdup(name);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
373 file->sections = g_list_append(file->sections, section);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
374
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
375 return section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
376 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
377
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
378 static RcLine *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
379 bmp_rcfile_create_string(RcSection * section,
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
380 const gchar * key, const gchar * value)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
381 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
382 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
383
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
384 line = g_new0(RcLine, 1);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
385 line->key = g_strstrip(g_strdup(key));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
386 line->value = g_strstrip(g_strdup(value));
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
387 section->lines = g_list_append(section->lines, line);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
388
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
389 return line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
390 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
391
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
392 static RcSection *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
393 bmp_rcfile_find_section(RcFile * file, const gchar * name)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
394 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
395 RcSection *section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
396 GList *list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
397
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
398 list = file->sections;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
399 while (list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
400 section = (RcSection *) list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
401 if (!strcasecmp(section->name, name))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
402 return section;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
403 list = g_list_next(list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
404 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
405 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
406 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
407
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
408 static RcLine *
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
409 bmp_rcfile_find_string(RcSection * section, const gchar * key)
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
410 {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
411 RcLine *line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
412 GList *list;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
413
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
414 list = section->lines;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
415 while (list) {
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
416 line = (RcLine *) list->data;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
417 if (!strcasecmp(line->key, key))
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
418 return line;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
419 list = g_list_next(list);
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
420 }
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
421 return NULL;
cb178e5ad177 [svn] Import audacious source.
nenolod
parents:
diff changeset
422 }