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 037a1c5d17a50945d8c02887d5b8c2cbff259256
parent c06b3738a246d410a94697a394e78b397e2986d3
Author: Christoph Lohmann <20h@r-36.net>
Date:   Mon, 25 Mar 2013 20:18:23 +0100

Fixing the pickstring generation for many arguments.

Diffstat:
bin/rpmigrate | 1+
pick.c | 15+++++++--------
2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/bin/rpmigrate b/bin/rpmigrate @@ -22,6 +22,7 @@ rpfold -qc "$cfgto" -l "$3" for msg in $(rpids -c "$cfgfrom" :); do + printf "msgid %d\n" "$msg" rpview -r -c "$cfgfrom" "$msg" | rpadd -c "$cfgto" -q; done diff --git a/pick.c b/pick.c @@ -148,11 +148,12 @@ pick_mksearchstring(char **argv[]) estr = smprintf("%s %s", estr, nestr); } + *argv = &(*argv)[1]; for (j = 0; expr->syntax[j] != PICK_END; j++) { - if (!(*argv)[1]) { + if (!(*argv)[0]) { die("Expected argument of type %s at '%s'\n", desc[(int)expr->syntax[j]], - (*argv)[0]); + (*argv)[-1]); } astr = estr; @@ -160,25 +161,23 @@ pick_mksearchstring(char **argv[]) case PICK_HEADERPREP: continue; case PICK_STR: - estr = smprintf("%s \"%s\"", estr, (*argv)[1]); - *argv = &(*argv)[2]; + estr = smprintf("%s \"%s\"", estr, (*argv)[0]); + *argv = &(*argv)[1]; break; case PICK_NUM: case PICK_KEY: case PICK_SEQ: case PICK_DATE: - estr = smprintf("%s %s", estr, (*argv)[1]); - *argv = &(*argv)[2]; + estr = smprintf("%s %s", estr, (*argv)[0]); + *argv = &(*argv)[1]; break; case PICK_EXPR: - *argv = &(*argv)[1]; rstr = pick_mksearchstring(argv); estr = smprintf("%s %s", estr, rstr); free(rstr); free(astr); continue; default: - *argv = &(*argv)[1]; continue; } free(astr);