diff options
-rw-r--r-- | export.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/export.c b/export.c index c563c3f..d6c7260 100644 --- a/export.c +++ b/export.c @@ -20,9 +20,7 @@ #include <stdint.h> #include <stdio.h> #include <stdlib.h> -#include <string.h> #include <sysexits.h> -#include <time.h> #include <unistd.h> #include "archive.h" @@ -97,18 +95,20 @@ void exportData(struct List items) { } else { errx(EX_PROTOCOL, "invalid data item name"); } - - if (name == AtomBody) { - i--; - continue; - } else if (name == AtomUID) { - uid = dataCheck(items.ptr[i + 1], Number).number; - } else if (name == AtomEnvelope) { - parseEnvelope(&envelope, dataCheck(items.ptr[i + 1], List).list); - } else if (name == AtomHeaderFields) { - header = dataCheck(items.ptr[i + 1], String).string; - } else if (name == AtomText) { - body = dataCheck(items.ptr[i + 1], String).string; + + struct Data data = items.ptr[i + 1]; + switch (name) { + break; case AtomBody: + i--; + break; case AtomUID: + uid = dataCheck(data, Number).number; + break; case AtomEnvelope: + parseEnvelope(&envelope, dataCheck(data, List).list); + break; case AtomHeaderFields: + header = dataCheck(data, String).string; + break; case AtomText: + body = dataCheck(data, String).string; + break; default:; } } |