git clone https://orangeshoelaces.net/git/tttm.git
Author: Vasily Kolobkov on 06/02/2016
Committer: Vasily Kolobkov on 06/02/2016
Allow to be invoked by UCSPI client
tttm.c | 12 ++++++--
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/tttm.c b/tttm.c
index 14cd9ab..660f33f 100644
--- a/tttm.c
+++ b/tttm.c
@@ -38,7 +38,7 @@ static char stortpl[] = "/tmp/tttm.XXXXXX";
int
main(int argc, char **argv)
{
- int e;
+ int e, in, out;
struct imapctx con;
char *namekey, *passkey;
char *name, *pass, *sink;
@@ -48,8 +48,10 @@ main(int argc, char **argv)
long sv;
namekey = passkey = 0;
+ in = STDIN_FILENO;
+ out = STDOUT_FILENO;
- while ((arg = getopt(argc, argv, "n:p:")) != -1) {
+ while ((arg = getopt(argc, argv, "n:p:u")) != -1) {
switch (arg) {
case 'n':
namekey = optarg;
@@ -57,6 +59,10 @@ main(int argc, char **argv)
case 'p':
passkey = optarg;
break;
+ case 'u':
+ in = 6;
+ out = 7;
+ break;
default:
usage();
}
@@ -78,7 +84,7 @@ main(int argc, char **argv)
if (unlink(stortpl) == -1)
warn("failed to unlink temporary storage");
- if ((e = imap_init(&con, STDIN_FILENO, STDOUT_FILENO, page))) {
+ if ((e = imap_init(&con, in, out, page))) {
terr(e, "failed to initialize session");
}
if (con.state == IS_AUTH) {