]> diplodocus.org Git - nmh/commitdiff
Support a -timeout switch.
authorKen Hornstein <kenh@pobox.com>
Thu, 9 Nov 2017 03:32:57 +0000 (22:32 -0500)
committerKen Hornstein <kenh@pobox.com>
Thu, 9 Nov 2017 03:32:57 +0000 (22:32 -0500)
uip/imaptest.c

index cd11aab55870e3bb3291243ab37fd03f594fcb01..e83c25e5c37c81fdfd9d725f117710a45e3ddd05 100644 (file)
@@ -33,6 +33,7 @@
     X("batch filename", 0, BATCHSW) \
     X("timestamp", 0, TIMESTAMPSW) \
     X("notimestamp", 0, NOTIMESTAMPSW) \
     X("batch filename", 0, BATCHSW) \
     X("timestamp", 0, TIMESTAMPSW) \
     X("notimestamp", 0, NOTIMESTAMPSW) \
+    X("timeout", 0, TIMEOUTSW) \
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
 
     X("version", 0, VERSIONSW) \
     X("help", 0, HELPSW) \
 
@@ -106,7 +107,7 @@ main (int argc, char **argv)
 {
     bool sasl = false, tls = false, initialtls = false;
     bool snoop = false, queue = false;
 {
     bool sasl = false, tls = false, initialtls = false;
     bool snoop = false, queue = false;
-    int fd;
+    int fd, timeout = 0;
     char *saslmech = NULL, *host = NULL, *port = "143", *user = NULL;
     char *cp, **argp, buf[BUFSIZ], *oauth_svc = NULL, *errstr, **arguments, *p;
     char *afolder = NULL;
     char *saslmech = NULL, *host = NULL, *port = "143", *user = NULL;
     char *cp, **argp, buf[BUFSIZ], *oauth_svc = NULL, *errstr, **arguments, *p;
     char *afolder = NULL;
@@ -169,6 +170,13 @@ main (int argc, char **argv)
                batchfile(*argp++, afolder, queue);
                continue;
 
                batchfile(*argp++, afolder, queue);
                continue;
 
+           case TIMEOUTSW:
+               if (! *argp || (**argp == '-'))
+                   die("missing argument to %s", argp[-1]);
+               if (! (timeout = atoi(*argp++)))
+                   die("Invalid timeout: %s", argp[-1]);
+               continue;
+
            case SNOOPSW:
                snoop = true;
                continue;
            case SNOOPSW:
                snoop = true;
                continue;
@@ -233,6 +241,9 @@ main (int argc, char **argv)
 
     netsec_set_hostname(nsc, host);
 
 
     netsec_set_hostname(nsc, host);
 
+    if (timeout)
+       netsec_set_timeout(nsc, timeout);
+
     if (snoop)
        netsec_set_snoop(nsc, 1);
 
     if (snoop)
        netsec_set_snoop(nsc, 1);