mgenmid: add option -d for custom domain

This commit is contained in:
Arav K 2021-05-31 08:26:27 +01:00
parent 6684f74f07
commit 1fa062532f
No known key found for this signature in database
GPG Key ID: 6D535EE45306731D

View File

@ -29,17 +29,26 @@ printb36(uint64_t x)
fputs(o, stdout);
}
int main()
int main(int argc, char *argv[])
{
char hostbuf[1024];
char *host = 0;
int c;
while ((c = getopt(argc, argv, "d:")) != -1)
switch (c) {
case 'd': host = optarg; break;
default:
fprintf(stderr, "Usage: mgenmid [-d domain]\n");
exit(1);
}
char *f = blaze822_home_file("profile");
struct message *config = blaze822(f);
xpledge("stdio rpath dns", "");
if (config) // try FQDN: first
if (!host && config) // try FQDN:
host = blaze822_hdr(config, "fqdn");
if (!host && gethostname(hostbuf, sizeof hostbuf) == 0) {