aboutsummaryrefslogtreecommitdiff
path: root/termo.c
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2016-09-27 23:30:10 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2016-09-27 23:30:10 +0200
commit991892fff518f59f02bbe1c8a4637843a82bd74e (patch)
treef8bb934a4481582789c5ecdee92233bd4d183369 /termo.c
parent9ec09b90c9bb023bb69a6b703ce4df40d397f5e6 (diff)
downloadtermo-991892fff518f59f02bbe1c8a4637843a82bd74e.tar.gz
termo-991892fff518f59f02bbe1c8a4637843a82bd74e.tar.xz
termo-991892fff518f59f02bbe1c8a4637843a82bd74e.zip
Allow specifying terminal name in termo_new()term-string
Diffstat (limited to 'termo.c')
-rw-r--r--termo.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/termo.c b/termo.c
index 953bc88..8a92821 100644
--- a/termo.c
+++ b/termo.c
@@ -415,7 +415,7 @@ abort_free_to_utf32:
}
termo_t *
-termo_new (int fd, const char *encoding, int flags)
+termo_new (int fd, const char *term, const char *encoding, int flags)
{
termo_t *tk = termo_alloc ();
if (!tk)
@@ -424,7 +424,11 @@ termo_new (int fd, const char *encoding, int flags)
tk->fd = fd;
termo_set_flags (tk, flags);
- const char *term = getenv ("TERM");
+ // In theory, we might have multiple different terminals open
+ // simultaneously; I'm not currently sure if it works
+ if (!term)
+ term = getenv ("TERM");
+
if (termo_init (tk, term, encoding)
&& termo_start (tk))
return tk;