about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/command/commands.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/command/commands.c b/src/command/commands.c
index ec49969c..0d5ce5e0 100644
--- a/src/command/commands.c
+++ b/src/command/commands.c
@@ -799,17 +799,17 @@ cmd_script(ProfWin *window, const char *const command, gchar **args)
 
 /* escape a string into csv and write it to the file descriptor */
 static int
-writecsv(int fd, const char *const str){
+_writecsv(int fd, const char *const str){
     if(!str) return 0;
     size_t len = strlen(str);
     char *s = malloc(2 * len * sizeof(char));
     char *c = s;
     int i = 0;
-    for(; i < strlen(str); i++){
+    for(; i < strlen(str); i++) {
         if(str[i] != '"') *c++ = str[i];
         else { *c++ = '"'; *c++ = '"'; len++; }
     }
-    if(-1 == write(fd, s, len)){
+    if(-1 == write(fd, s, len)) {
         cons_show("error: failed to write '%s' to the requested file: %s", s, strerror(errno));
         return -1;
     }
@@ -821,12 +821,10 @@ gboolean
 cmd_export(ProfWin *window, const char *const command, gchar **args)
 {
     if(args[0]){
-        /* temporary, we SHOULD pass everything to an escape function (to escape out quotes)
-         * and then use fputs */
         int fd = open(args[0], O_WRONLY | O_CREAT, 00600);
         GSList *list = NULL;
 
-        if(-1 == fd){
+        if(-1 == fd) {
             cons_show("error: cannot open %s: %s", args[0], strerror(errno));
             cons_show("");
             return TRUE;
@@ -835,7 +833,7 @@ cmd_export(ProfWin *window, const char *const command, gchar **args)
         if(-1 == write(fd, "jid,name\n", strlen("jid,name\n"))) goto write_error;
 
         list = roster_get_contacts(ROSTER_ORD_NAME, TRUE);
-        if(list){
+        if(list) {
             GSList *curr = list;
             while(curr){
                 PContact contact = curr->data;
='#n137'>137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264