tttm

git clone https://orangeshoelaces.net/git/tttm.git

6b20d75fad5e95bca3fff0331060ef22f5a8f94c

Author: Vasily Kolobkov on 06/03/2016

Committer: Vasily Kolobkov on 06/03/2016

Dump explicit UCSPI calling convention support

Why pile up on functions shells have a better grasp of?

Stats

tttm.1 |  8 --
tttm.c | 31 +++-----
2 files changed, 9 insertions(+), 30 deletions(-)

Patch

diff --git a/tttm.1 b/tttm.1
index f9d28ba..9682a1e 100644
--- a/tttm.1
+++ b/tttm.1
@@ -6,7 +6,6 @@
 .Nd mail retrieval agent
 .Sh SYNOPSIS
 .Nm
-.Op Fl u
 .Ar sink
 .Sh DESCRIPTION
 .Nm , a loose initialism for
@@ -18,13 +17,6 @@ Mail is deleted from server afterwards.
 .Pp
 Communication with mail server is carried out on standard input (server replies)
 and output (client commands).
-.Pp
-The options are as follows:
-.Bl -tag -width Ds
-.It Fl u
-Pertain to UCSPI specification, reading input on file descriptor 6, and
-writing commands to file descriptor 7.
-.El
 .Sh ENVIRONMENT
 In most likely case of authentication taking place within IMAP session,
 pass login credentials in following environment variables to thwart
diff --git a/tttm.c b/tttm.c
index a6a2b7d..ef0ce96 100644
--- a/tttm.c
+++ b/tttm.c
@@ -40,45 +40,32 @@ static char	*passkey = "IMAP_PASS";
 int
 main(int argc, char **argv)
 {
-	int e, in, out;
+	int e;
 	struct imapctx con;
 	char *user, *pass, *sink;
 	int stor;
-	int arg, refetchc, batchsz, mpiped;
+	int refetchc, batchsz, mpiped;
 	struct msgd bag[BATCHSZ], *m, *bend;
-	long sv;
-
-	in = STDIN_FILENO;
-	out = STDOUT_FILENO;
+	long sysvar;
 
-	while ((arg = getopt(argc, argv, "u")) != -1) {
-		switch (arg) {
-		case 'u':
-			in = 6;
-			out = 7;
-			break;
-		default:
-			usage();
-		}
-	}
-	argc -= optind;
-	argv += optind;
+	argc--;
+	argv++;
 	if (argc == 1) {
 		sink = *argv;
 	} else {
 		usage();
 	}
 
-	if ((sv = sysconf(_SC_PAGESIZE)) == -1)
+	if ((sysvar = sysconf(_SC_PAGESIZE)) == -1)
 		err(1, "failed to find out page size");
-	page = sv;
+	page = sysvar;
 
 	if ((stor = mkstemp(stortpl)) == -1)
 		err(1, "failed to set up temporary storage");
 	if (unlink(stortpl) == -1)
 		warn("failed to unlink temporary storage");
 
-	if ((e = imap_init(&con, in, out, page))) {
+	if ((e = imap_init(&con, STDIN_FILENO, STDOUT_FILENO, page))) {
 		terr(e, "failed to initialize session");
 	}
 	if (con.state == IS_AUTH) {
@@ -329,5 +316,5 @@ twarn(int e, const char *msg)
 void
 usage(void)
 {
-	errx(1, "usage: tttm [-n namekey] [-p passkey] sink");
+	errx(1, "usage: tttm sink");
 }