]> code.citadel.org Git - citadel.git/blobdiff - citadel/utils/ctdlload.c
Fix ansi auto-detect
[citadel.git] / citadel / utils / ctdlload.c
index cc25ef28a8a896882e6c027b8f932d133cc8cb9b..aed19b472cc1ec0e9d2d73d4ef7551afa4e343e1 100644 (file)
@@ -118,6 +118,7 @@ int import_user(char *line, struct cdbkeyval *kv) {
        char userkey[USERNAME_SIZE];
        char *token;
        struct ctdluser *u;
+       int dlen = 0;
 
        u = malloc(sizeof(struct ctdluser));
        if (!u) {
@@ -163,7 +164,6 @@ int import_user(char *line, struct cdbkeyval *kv) {
                                u->msgnum_pic = atol(token);
                                break;
                        case 12:
-                               int dlen;
                                dlen = CtdlDecodeBase64(token, token, strlen(token));                   // Decode in place
                                if (dlen >= sizeof(u->emailaddrs)) {
                                        dlen = sizeof(u->emailaddrs) - 1;
@@ -696,6 +696,7 @@ void ingest_one(char *line, struct cdbkeyval *kv) {
                ++good_rows;
        }
        else {
+               fprintf(stderr, "bad row: <%s>\n", line);
                ++bad_rows;
        }
 
@@ -736,6 +737,10 @@ void ingest(void) {
                }
 
                if (line_len > 0) {
+                       if (!strncasecmp(line, HKEY("end|"))) {
+                               fprintf(stderr, "\n");
+                               end_found = 1;
+                       }
                        if ( (begin_found) && (!end_found) ) {
                                ingest_one(line, &kv);
                        }
@@ -743,10 +748,6 @@ void ingest(void) {
                                begin_found = 1;
                                fprintf(stderr, "   good rows / bad rows:\n");
                        }
-                       if (!strncasecmp(line, HKEY("end|"))) {
-                               fprintf(stderr, "\n");
-                               end_found = 1;
-                       }
                }
 
        } while (ch >= 0);