rohrpost

A commandline mail client to change the world as we see it.
git clone git://r-36.net/rohrpost
Log | Files | Refs | LICENSE

commit eaf00815b8fa1957f8a89667d33e1e74bfbe083d
parent f9345d316c22c3153a204ae36054f2902b445867
Author: Christoph Lohmann <20h@r-36.net>
Date:   Wed, 11 Jul 2012 19:08:55 +0200

View for rpdrafts and now malformed headers are parsed.

Diffstat:
bin/rpdrafts | 18+++++++++++++++---
mime.c | 12+++++++-----
2 files changed, 22 insertions(+), 8 deletions(-)

diff --git a/bin/rpdrafts b/bin/rpdrafts @@ -1,13 +1,15 @@ #!/bin/sh usage() { - echo "usage: `basename $1` [-h] [[-e|-d]ids]" + printf "usage. %s [h] [[-e|-d|-v]ids|-l]\n" "$(basename $1)" >&2 + exit 1 } doedit=0 dodelete=0 +doview=0 -while getopts "hed" opt; +while getopts "hedvl" opt; do case $opt in e) @@ -16,9 +18,13 @@ do d) dodelete=1 ;; + v) + doview=1 + ;; + l) + ;; *) usage $0 - exit 1 ;; esac done @@ -39,6 +45,12 @@ then exit $? fi +if [ $doview -eq 1 ]; +then + rpview -r -m $dfolder -- "$@" + exit $? +fi + if [ $doedit -eq 0 ] && [ $dodelete -eq 0 ]; then rpscan -m $dfolder -- "$@" diff --git a/mime.c b/mime.c @@ -761,7 +761,7 @@ mime_t * mime_parsebufintern(mime_t *mime, char *str, int len) { int i, partlen, isend; - char *p, *rp, buf[1025], *key, *value, *part; + char *p, *rp, buf[1025], *key, *value, *tvalue, *part; llistelem_t *hdr; mime_t *partm; @@ -824,12 +824,14 @@ mime_parsebufintern(mime_t *mime, char *str, int len) */ key = NULL; value = NULL; - sscanf(buf, "%1024m[^: \t\r\v\f]:%*[ \t\r\v\f]" + tvalue = NULL; + sscanf(buf, "%1024m[^: \t\r\v\f]:" "%1024m[^\n]", &key, &value); - //printf("%s = %s\n", key, value); + tvalue = value + strspn(value, " \t\r\v\f"); + printf("%s = %s\n", key, tvalue); if (key != NULL && value != NULL) { - hdr = llistelem_new(key, value, - strlen(value)+1); + hdr = llistelem_new(key, tvalue, + strlen(tvalue)+1); llist_addelem(mime->hdrs, hdr); mime->state = HEADERVALUE; }