gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r4707 - GNUnet/src/util/config_impl


From: gnunet
Subject: [GNUnet-SVN] r4707 - GNUnet/src/util/config_impl
Date: Sun, 25 Mar 2007 14:36:48 -0600 (MDT)

Author: grothoff
Date: 2007-03-25 14:36:48 -0600 (Sun, 25 Mar 2007)
New Revision: 4707

Modified:
   GNUnet/src/util/config_impl/impl.c
Log:
fixing newline issue

Modified: GNUnet/src/util/config_impl/impl.c
===================================================================
--- GNUnet/src/util/config_impl/impl.c  2007-03-25 19:54:28 UTC (rev 4706)
+++ GNUnet/src/util/config_impl/impl.c  2007-03-25 20:36:48 UTC (rev 4707)
@@ -310,6 +310,8 @@
   int error;
   int ret;
   char * fn;
+  char * val;
+  char * pos;
 
   fn = string_expandFileName(NULL, filename);
   disk_directory_create_for_file(NULL, fn);
@@ -339,13 +341,24 @@
       GE_ASSERT(data->ectx,
                e->dirty_val == NULL);
       if (e->val != NULL) {
+       val = MALLOC(strlen(e->val) * 2 + 1);
+       strcpy(val, e->val);
+       while (NULL != (pos = strstr(val, "\n"))) {
+         memmove(&pos[2],
+                 &pos[1],
+                 strlen(&pos[1]));
+         pos[0] = '\\';
+         pos[1] = 'n';
+       }
        if (0 > fprintf(fp,
                        "%s = %s\n",
                        e->key,
-                       e->val)) {
+                       val)) {
          error = 1;
+         FREE(val);
          break;
        }
+       FREE(val);
       }
     }
     if (error != 0)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]