#define _GNU_SOURCE
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include "../src/cmime_message.h"
void usage() {
printf("\n");
printf("libcmime - simple api demonstration\n");
printf("-----------------------------------\n");
printf("demonstrates: manual creation of new CMimeMessage_T mime message\n");
printf("output: output is written to stdout if no output file is specified (-f /path/to/out_file.txt)\n");
printf("\n");
exit(0);
}
int main(int argc, char *argv[]) {
char from[] = "from@example.org";
char to[] = "to@example.org";
char *file = NULL;
char *out = NULL;
char *msgid = NULL;
int option;
while((option = getopt(argc,argv,"hf:")) != EOF) {
switch(option) {
case 'f':
asprintf(&file, "%s", optarg);
break;
case 'h':
usage();
break;
default:
usage();
}
}
if(file != NULL) {
printf("file created: %s\n", file);
} else {
printf("error writing file: %s\n", file);
}
} else {
printf("%s\n", out);
}
if(out != NULL)
free(out);
if(msgid != NULL)
free(msgid);
if(file != NULL)
free(file);
return (0);
}