mirror of
https://github.com/leahneukirchen/mblaze
synced 2024-11-15 18:14:02 +00:00
mgenmid: add option -d for custom domain
This commit is contained in:
parent
6684f74f07
commit
1fa062532f
13
mgenmid.c
13
mgenmid.c
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user