Mercurial > ~mikael > mcabber > hg
comparison mcabber/mcabber/help.c @ 1729:e6e89b1d7831
Minor style and header updates
author | Mikael Berthe <mikael@lilotux.net> |
---|---|
date | Sun, 28 Feb 2010 15:19:27 +0100 |
parents | e489ead6574a |
children | 6abca6000762 |
comparison
equal
deleted
inserted
replaced
1728:15b3834cbe5f | 1729:e6e89b1d7831 |
---|---|
166 | 166 |
167 if (arg && *arg) | 167 if (arg && *arg) |
168 fname = g_strdup_printf("%s/hlp_%s.txt", path, arg); | 168 fname = g_strdup_printf("%s/hlp_%s.txt", path, arg); |
169 else | 169 else |
170 fname = g_strdup_printf("%s/hlp.txt", path); | 170 fname = g_strdup_printf("%s/hlp.txt", path); |
171 | 171 |
172 channel = g_io_channel_new_file(fname, "r", NULL); | 172 channel = g_io_channel_new_file(fname, "r", NULL); |
173 | 173 |
174 if (!channel) | 174 if (!channel) |
175 return FALSE; | 175 return FALSE; |
176 | 176 |
177 line = g_string_new(NULL); | 177 line = g_string_new(NULL); |
178 | 178 |
179 while (TRUE) { | 179 while (TRUE) { |
180 gsize endpos; | 180 gsize endpos; |
181 GIOStatus ret; | 181 GIOStatus ret; |
182 | 182 |
183 ret = g_io_channel_read_line_string(channel, line, &endpos, NULL); | 183 ret = g_io_channel_read_line_string(channel, line, &endpos, NULL); |
184 if (ret != G_IO_STATUS_NORMAL) // XXX G_IO_STATUS_AGAIN? | 184 if (ret != G_IO_STATUS_NORMAL) // XXX G_IO_STATUS_AGAIN? |
185 break; | 185 break; |
186 | 186 |
187 line->str[endpos] = '\0'; | 187 line->str[endpos] = '\0'; |
232 mc_strtolower(string); | 232 mc_strtolower(string); |
233 } | 233 } |
234 | 234 |
235 if (settings_opt_get_int("help_to_current") && CURRENT_JID) | 235 if (settings_opt_get_int("help_to_current") && CURRENT_JID) |
236 jid = CURRENT_JID; | 236 jid = CURRENT_JID; |
237 | 237 |
238 { // search | 238 { // search |
239 GSList *hel; | 239 GSList *hel; |
240 | 240 |
241 for (hel = help_dirs; hel && !done; hel = hel->next) { | 241 for (hel = help_dirs; hel && !done; hel = hel->next) { |
242 char *dir = (char *)hel->data; | 242 char *dir = (char *)hel->data; |
266 if (nend) { | 266 if (nend) { |
267 gsize len = nend - nstart; | 267 gsize len = nend - nstart; |
268 | 268 |
269 if (g_strstr_len(nstart, len, string)) { | 269 if (g_strstr_len(nstart, len, string)) { |
270 gchar *match = g_strndup(nstart, len); | 270 gchar *match = g_strndup(nstart, len); |
271 | 271 |
272 if (!g_slist_find_custom(matches, match, | 272 if (!g_slist_find_custom(matches, match, |
273 (GCompareFunc)strcmp)) | 273 (GCompareFunc)strcmp)) |
274 matches = g_slist_append(matches, match); | 274 matches = g_slist_append(matches, match); |
275 else | 275 else |
276 g_free(match); | 276 g_free(match); |