commit ffa36588d8644c0673a9fcc8d0a9a006e7b697f2
parent 03f58bfef1d037ed254246bc645ea611b073c548
Author: pancake@localhost.localdomain <unknown>
Date: Mon, 2 Nov 2009 02:18:46 +0100
* Added some debugging in dmc pull - its buggy
* Fix command output for imap4
Diffstat:
2 files changed, 9 insertions(+), 8 deletions(-)
diff --git a/dmc b/dmc
@@ -37,8 +37,9 @@ function dmc_cmd {
function start_account_daemons {
i=0
for a in ~/.dmc/acc/* ; do
- ( source $a ; acc_daemon ) &
+ ( . $a ; acc_daemon ) &
i=$(($i+1))
+ sleep 1
done
if [ "$i" = 0 ]; then
echo "No accounts defined in ~/.dmc/acc"
@@ -133,12 +134,14 @@ function pull_mails {
i=1
while [ ! "$LIMIT" = "$i" ] ; do
dmc -c cat $i > ~/.dmc/box/${NAME}/in/$i.eml 2> ~/.dmc/tmp/${NAME}.tmp
- if [ -n "`cat ~/.dmc/tmp/${NAME}.tmp | grep ERR`" ]; then
- rm ~/.dmc/box/${NAME}/in/$i.eml
+ if [ -n "`cat ~/.dmc/tmp/${NAME}.tmp | grep 'cat 0'`" ]; then
+ rm -f ~/.dmc/box/${NAME}/in/$i.eml
+ echo "EOF $i"
+ cat ~/.dmc/tmp/${NAME}.tmp
break
else
size=`du -hs ~/.dmc/box/${NAME}/in/$i.eml | awk '{print \$1}'`
- echo "got $i $size"
+ echo "got $i $size $(cat ~/.dmc/tmp/${NAME}.tmp)"
fi
i=$(($i+1))
done
@@ -149,7 +152,6 @@ function ign { : ; }
case "$1" in
"start")
start_account_daemons
- sleep 1
;;
"stop")
cd ~/.dmc/tmp
@@ -220,9 +222,7 @@ case "$1" in
printf "> "
read A
dmc_cmd "$A"
- if [ "$A" = "exit" ]; then
- exit 0
- fi
+ [ "$A" = "exit" ] && exit 0
done
else
shift
diff --git a/imap4.c b/imap4.c
@@ -61,6 +61,7 @@ static int waitreply() {
char result[256];
ftruncate (2, 0);
+ lseek (2, 0, SEEK_SET);
word[0] = result[0] = '\0';
while(lock || sock_ready()) {
lock = 0;