diff --git a/include/config.h b/include/config.h index 17fa5b5..9dd62db 100644 --- a/include/config.h +++ b/include/config.h @@ -30,4 +30,8 @@ extern char* instance_id; extern int verbose; +extern char* directory; +extern char* url_base; + + #endif /* CONFIG_H */ diff --git a/src/config.c b/src/config.c index 0da3bec..5a65cc6 100644 --- a/src/config.c +++ b/src/config.c @@ -24,3 +24,6 @@ int abort_on_pgp = true, abort_on_dkim = true; char* instance_id = NULL; int verbose = false; +char* directory = NULL; +char* url_base = NULL; + diff --git a/src/main.c b/src/main.c index ce743f6..11d1e08 100644 --- a/src/main.c +++ b/src/main.c @@ -33,12 +33,14 @@ int main(int argc, char* argv[]){ {"in-port", required_argument, 0, 'i'}, {"out-port", required_argument, 0, 'o'}, {"instance-id", required_argument, 0, 'n'}, + {"directory", required_argument, 0, 'd'}, + {"url", required_argument, 0, 'u'}, {0, 0, 0, 0} }; /* getopt_long stores the option index here. */ int option_index = 0; - c = getopt_long (argc, argv, "n:i:o:pd", + c = getopt_long (argc, argv, "n:i:o:d:u:", long_options, &option_index); /* Detect the end of the options. */ @@ -60,6 +62,13 @@ int main(int argc, char* argv[]){ case 'n': instance_id = optarg; break; + + case 'd': + directory = optarg; + break; + case 'u': + url_base = optarg; + break; case '?': /* getopt_long already printed an error message. */ @@ -81,6 +90,17 @@ int main(int argc, char* argv[]){ perror("gethostname failed! set instance id manually"); } } + + if(directory == NULL){ + fprintf(stderr, "directory option MUST be set!\n"); + return EXIT_FAILURE; + } + + if(url_base == NULL){ + fprintf(stderr, "url option MUST be set!\n"); + return EXIT_FAILURE; + } + if(verbose){ printf("Incoming port: %u outgoing port: %u on loopback " @@ -94,6 +114,9 @@ int main(int argc, char* argv[]){ printf("Instance id for messages: %s\n", instance_id); + + printf("Placing files into [%s] linked by [%s]\n", directory, + url_base); } if(init_net() < 0){