main: allow TERM to be set on the command line

This commit is contained in:
Daniel Eklöf 2019-07-18 14:34:45 +02:00
parent 7e36027237
commit 7d7af62d84
No known key found for this signature in database
GPG key ID: 5BBD4992C116573F

8
main.c
View file

@ -278,6 +278,7 @@ main(int argc, char *const *argv)
return ret; return ret;
static const struct option longopts[] = { static const struct option longopts[] = {
{"term", required_argument, 0, 't'},
{"font", required_argument, 0, 'f'}, {"font", required_argument, 0, 'f'},
{NULL, no_argument, 0, 0}, {NULL, no_argument, 0, 0},
}; };
@ -285,11 +286,16 @@ main(int argc, char *const *argv)
//const char *font_name = "monospace"; //const char *font_name = "monospace";
while (true) { while (true) {
int c = getopt_long(argc, argv, ":f:h", longopts, NULL); int c = getopt_long(argc, argv, ":t:f:h", longopts, NULL);
if (c == -1) if (c == -1)
break; break;
switch (c) { switch (c) {
case 't':
free(conf.term);
conf.term = strdup(optarg);
break;
case 'f': case 'f':
free(conf.font); free(conf.font);
conf.font = strdup(optarg); conf.font = strdup(optarg);