commit 37ac0f1aaaf679dd350bc6da395014f82d202287
parent ab5c262f1c5800c2c3537b34aedf1187c3b38abe
Author: nibble <unknown>
Date: Wed, 18 Nov 2009 15:10:48 +0100
* Minor code clean-up in imap4.c
* Update headers
Diffstat:
10 files changed, 41 insertions(+), 31 deletions(-)
diff --git a/dmc b/dmc
@@ -1,10 +1,8 @@
#!/bin/sh
+# dmc - dynamic mail client
# See LICENSE file for copyright and license details.
-#---
-# dmc - dynamic mail client - pancake <at> nopcode <dot> org
VERSION="0.1"
-COPYRIGHT="Copyleft -- pancake@nopcode.org"
HELP="Usage: dmc [-hv] [-e acc] [-a addr] [-m addr subj] [-A file] [-s msg] [action]"
[ -z "${EDITOR}" ] && EDITOR=vim
@@ -260,7 +258,7 @@ case "$1" in
fi
;;
"-v"|"--version")
- echo "dmc v${VERSION} ${COPYRIGHT}"
+ echo "dmc v${VERSION}"
;;
"--help"|"-h")
echo ${HELP}
diff --git a/dmc-mdir b/dmc-mdir
@@ -1,6 +1,6 @@
#!/bin/sh
# dmc - dynamic mail client
-# Copyleft 2009 -- pancake <at> nopcode <dot> org
+# See LICENSE file for copyright and license details.
# TODO: rewrite in C
MD=$1
diff --git a/dmc-tag b/dmc-tag
@@ -1,8 +1,10 @@
#!/bin/sh
# dmc - dynamic mail client
-# Copyleft 2009 -- pancake <at> nopcode <dot> org
+# See LICENSE file for copyright and license details.
# TODO: rewrite in C
+VERSION="0.1"
+
[ -z "${DMCTAG_ROOT}" ] && \
DMCTAG_ROOT="${HOME}/.dmctag"
if [ ! -d "${DMCTAG_ROOT}" ]; then
@@ -84,7 +86,7 @@ case "$1" in
untag ${FILE}
;;
"-v")
- echo "dmc-tag-0.1 (c) 2009 pancake(at)nopcode(dot)org"
+ echo "dmc-tag v${VERSION}"
;;
"")
echo "Usage: dmc-tag [-uhv] [-l [tag ..]] [-c [file ..]] [-m dir dir] [file ..]"
diff --git a/filter.c b/filter.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft -- nibble (at) develsec (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <stdlib.h>
diff --git a/imap4.c b/imap4.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft 2009 -- pancake (at) nopcode (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <poll.h>
#include <fcntl.h>
@@ -13,9 +15,8 @@
static char *cmd = NULL;
static char word[4096];
-static int ctr = 1;
-static int catmode = 0;
static char *dir;
+static int ctr = 1;
/* TODO clean this ugly code */
static char *getword() {
@@ -52,7 +53,7 @@ reread:
return word;
}
-static int waitreply() {
+static int waitreply(int catmode) {
char *ptr;
int lock = 1;
int line = 0;
@@ -128,7 +129,6 @@ RECENT - show the number of recent messages
#endif
static int doword(char *word) {
int ret = 1;
- catmode = 0;
free (cmd);
cmd = strdup (word);
if (*word == '\0') {
@@ -136,7 +136,7 @@ static int doword(char *word) {
} else
if (!strcmp (word, "exit")) {
sock_printf ("%d LOGOUT\n", ctr++);
- waitreply ();
+ waitreply (0);
ret = 0;
} else
if (!strcmp (word, "help") || !strcmp (word, "?")) {
@@ -151,27 +151,25 @@ static int doword(char *word) {
if (!strcmp (dir, "\"\""))
*dir = 0;
sock_printf ("%d SELECT \"%s\"\n", ctr++, dir);
- waitreply ();
+ waitreply (0);
} else
if (!strcmp (word, "find")) {
sock_printf ("%d SEARCH TEXT \"%s\"\n", ctr++, getword ());
- waitreply ();
+ waitreply (0);
} else
if (!strcmp (word, "ls")) {
sock_printf ("%d LIST \"%s\" *\n", ctr++, dir);
- waitreply ();
+ waitreply (0);
} else
if (!strcmp (word, "cat")) {
- catmode = 1;
sock_printf ("%d FETCH %d body[]\n",
ctr++, atoi (getword ()));
- waitreply ();
+ waitreply (1);
} else
if (!strcmp (word, "head")) {
- catmode = 1;
sock_printf ("%d FETCH %d body[header]\n",
ctr++, atoi (getword ()));
- waitreply ();
+ waitreply (1);
} else
if (!strcmp (word, "mvdir")) {
sock_printf ("%d RENAME %s %s\n",
@@ -182,12 +180,12 @@ static int doword(char *word) {
} else
if (!strcmp (word, "rm")) {
sock_printf ("%d DELE %d\n", ctr++, atoi (getword ()));
- waitreply ();
+ waitreply (0);
} else
if (!strcmp (word, "rmdir")) {
printf("%d DELETE \"%s\"\n",
ctr++, getword ());
- waitreply ();
+ waitreply (0);
} else
if (!strcmp (word, "login")) {
char *user = strdup (getword ());
@@ -196,10 +194,10 @@ static int doword(char *word) {
ctr++, user, pass);
free (user);
free (pass);
- waitreply ();
+ waitreply (0);
} else {
sock_printf ("%d NOOP\n", ctr++);
- waitreply ();
+ waitreply (0);
}
return ret;
}
@@ -212,7 +210,7 @@ int main (int argc, char **argv) {
if (sock_connect (argv[1], atoi (argv[2]), ssl) >= 0) {
ret = 0;
atexit (sock_close);
- waitreply ();
+ waitreply (0);
dir = strdup ("");
while (doword (getword ()));
} else printf ("Cannot connect to %s %d\n", argv[1], atoi (argv[2]));
diff --git a/mbox.c b/mbox.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft 2009 -- nibble (at) develsec (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <string.h>
diff --git a/pack.c b/pack.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft -- nibble (at) develsec (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <stdlib.h>
diff --git a/pop3.c b/pop3.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft 2009 -- pancake (at) nopcode (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <string.h>
diff --git a/smtp.c b/smtp.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft 2009 -- pancake (at) nopcode (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <stdio.h>
diff --git a/sock.c b/sock.c
@@ -1,4 +1,6 @@
-/* dmc :: Copyleft 2009 -- pancake (at) nopcode (dot) org */
+/* dmc - dynamic mail client
+ * See LICENSE file for copyright and license details.
+ */
#include <stdio.h>
#include <string.h>