tFixing the makefile and making rpflag more consistent. - rohrpost - A commandline mail client to change the world as we see it.
 (HTM) git clone git://r-36.net/rohrpost
 (DIR) Log
 (DIR) Files
 (DIR) Refs
 (DIR) LICENSE
       ---
 (DIR) commit 119cc0c7df1604df82651fdc9ea6afa9b884452f
 (DIR) parent b0ac2d0ce204637d2ce5c8845ea6f8a86d64dc3d
 (HTM) Author: Christoph Lohmann <20h@r-36.net>
       Date:   Sun, 23 Dec 2012 09:48:48 +0100
       
       Fixing the makefile and making rpflag more consistent.
       
       Diffstat:
         Makefile                            |       6 +++---
         flag.c                              |      48 ++++++++++++-------------------
       
       2 files changed, 21 insertions(+), 33 deletions(-)
       ---
 (DIR) diff --git a/Makefile b/Makefile
       t@@ -67,10 +67,10 @@ install: all bin
                chmod 755 ${DESTDIR}${PREFIX}/bin/${NAME}; \
                for i in `ls -1`; \
                do \
       -                if [ -e ${DESTDIR}${PREFIX}/bin/$$i ];
       +                if [ -e ${DESTDIR}${PREFIX}/bin/$$i ]; \
                        then \
       -                        rm -f ${DESTDIR}${PREFIX}/bin/$$i \
       -                fi \
       +                        rm -f ${DESTDIR}${PREFIX}/bin/$$i; \
       +                fi; \
                        \
                        if [ ! -L $$i ]; \
                        then \
 (DIR) diff --git a/flag.c b/flag.c
       t@@ -180,7 +180,6 @@ flagmain(int argc, char *argv[])
                if (imap_select(imap, selected))
                        imap_die(imap, "imap_select");
        
       -        user = imap_ids2str(ids);
                if (flagl != NULL) {
                        pass = llist_joinstr(flagl, " ");
                } else {
       t@@ -190,40 +189,29 @@ flagmain(int argc, char *argv[])
                if (status & DOSET) {
                        if (imap_setflags(imap, ids, flagl))
                                imap_die(imap, "imap_setflags");
       -                if (!(status & BEQUIET)) {
       -                        printf("Flags '%s' set for the messages '%s' in "
       -                                        "folder %s.\n",
       -                                        pass, user, selected);
       -                }
                } else if (status & DODELETE) {
                        if (imap_delflags(imap, ids, flagl))
                                imap_die(imap, "imap_delflags");
       -                if (!(status & BEQUIET)) {
       -                        printf("Flags '%s' deleted from messages '%s' in "
       -                                        "folder %s.\n",
       -                                        pass, user, selected);
       -                }
       -        } else {
       -                free(user);
       +        }
       +        free(user);
        
       -                flagrl = imap_getflags(imap, ids);
       -                if (flagrl == NULL)
       -                        imap_die(imap, "imap_getflags");
       -
       -                printf("ID\tFlags\n");
       -
       -                forllist(flagrl, elem) {
       -                        flagel = (llist_t *)elem->data;
       -                        user = llist_joinstr((llist_t *)flagel->last->data,
       -                                        " ");
       -                        if (user == NULL)
       -                                user = memdup("", 1);
       -                        printf("%s\t%s\n", (char *)flagel->first->data, user);
       -                        free(user);
       -                        user = NULL;
       -                }
       -                llist_efree(flagrl);
       +        flagrl = imap_getflags(imap, ids);
       +        if (flagrl == NULL)
       +                imap_die(imap, "imap_getflags");
       +
       +        printf("ID\tFlags\n");
       +
       +        forllist(flagrl, elem) {
       +                flagel = (llist_t *)elem->data;
       +                user = llist_joinstr((llist_t *)flagel->last->data,
       +                                " ");
       +                if (user == NULL)
       +                        user = memdup("", 1);
       +                printf("%s\t%s\n", (char *)flagel->first->data, user);
       +                free(user);
       +                user = NULL;
                }
       +        llist_efree(flagrl);
        
                if (flagl != NULL)
                        llist_free(flagl);