/[weechat]/weechat/src/plugins/plugins-config.c
ViewVC logotype

Diff of /weechat/src/plugins/plugins-config.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by flashcode, Sun Oct 30 09:56:24 2005 UTC revision 1.3 by flashcode, Sat Nov 19 22:08:46 2005 UTC
# Line 219  plugin_config_read () Line 219  plugin_config_read ()
219                  {                  {
220                      pos[0] = '\0';                      pos[0] = '\0';
221                      pos++;                      pos++;
222                        
223                        /* remove spaces before '=' */
224                        pos2 = pos - 2;
225                        while ((pos2 > line) && (pos2[0] == ' '))
226                        {
227                            pos2[0] = '\0';
228                            pos2--;
229                        }
230                        
231                        /* skip spaces after '=' */
232                        while (pos[0] && (pos[0] == ' '))
233                        {
234                            pos++;
235                        }
236                        
237                        /* remove CR/LF */
238                      pos2 = strchr (pos, '\r');                      pos2 = strchr (pos, '\r');
239                      if (pos2 != NULL)                      if (pos2 != NULL)
240                          pos2[0] = '\0';                          pos2[0] = '\0';
241                      pos2 = strchr (pos, '\n');                      pos2 = strchr (pos, '\n');
242                      if (pos2 != NULL)                      if (pos2 != NULL)
243                          pos2[0] = '\0';                          pos2[0] = '\0';
244                        
245                        /* remove simple or double quotes
246                           and spaces at the end */
247                        if (strlen(pos) > 1)
248                        {
249                            pos2 = pos + strlen (pos) - 1;
250                            while ((pos2 > pos) && (pos2[0] == ' '))
251                            {
252                                pos2[0] = '\0';
253                                pos2--;
254                            }
255                            pos2 = pos + strlen (pos) - 1;
256                            if (((pos[0] == '\'') &&
257                                 (pos2[0] == '\'')) ||
258                                ((pos[0] == '"') &&
259                                 (pos2[0] == '"')))
260                            {
261                                pos2[0] = '\0';
262                                pos++;
263                            }
264                        }
265                        
266                      plugin_config_set_internal (ptr_line, pos);                      plugin_config_set_internal (ptr_line, pos);
267                  }                  }
268              }              }
# Line 279  plugin_config_write () Line 317  plugin_config_write ()
317      for (ptr_plugin_option = plugin_options; ptr_plugin_option;      for (ptr_plugin_option = plugin_options; ptr_plugin_option;
318           ptr_plugin_option = ptr_plugin_option->next_option)           ptr_plugin_option = ptr_plugin_option->next_option)
319      {      {
320          fprintf (file, "%s=%s\n",          fprintf (file, "%s = \"%s\"\n",
321                   ptr_plugin_option->option_name,                   ptr_plugin_option->option_name,
322                   ptr_plugin_option->value);                   ptr_plugin_option->value);
323      }      }

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26