dmc

dynamic mail client
git clone git://git.suckless.org/dmc
Log | Files | Refs | README | LICENSE

commit 6fe9d1430bad2be16b9f17438cd447cf792a3822
parent 665713c68900396ba62897a8d3e0ce6f3a90a86c
Author: nibble <unknown>
Date:   Sun, 25 Oct 2009 12:16:12 +0100

* Added dmc-pack into Makefile
* Minor fixes and code cleanup in dmc-pack
Diffstat:
Makefile | 9+++++++--
pack.c | 8+++-----
2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile @@ -2,7 +2,7 @@ CC?=gcc PREFIX?=/usr CFLAGS?=-Wall -all: dmc-smtp dmc-pop3 dmc-imap4 +all: dmc-smtp dmc-pop3 dmc-imap4 dmc-pack dmc-smtp: smtp.o ${CC} ${LDFLAGS} smtp.o -o dmc-smtp -lresolv @@ -13,21 +13,26 @@ dmc-pop3: pop3.o dmc-imap4: imap4.o ${CC} ${LDFLAGS} imap4.o -o dmc-imap4 +dmc-pack: pack.o + ${CC} ${LDFLAGS} pack.o -o dmc-pack + install: cp -f dmc.1 ${PREFIX}/share/man/man1 cp -f dmc ${PREFIX}/bin cp -f dmc-smtp ${PREFIX}/bin cp -f dmc-pop3 ${PREFIX}/bin cp -f dmc-imap4 ${PREFIX}/bin + cp -f dmc-pack ${PREFIX}/bin uninstall: rm -f ${PREFIX}/bin/dmc rm -f ${PREFIX}/bin/dmc-smtp rm -f ${PREFIX}/bin/dmc-pop3 rm -f ${PREFIX}/bin/dmc-imap4 + rm -f ${PREFIX}/bin/dmc-pack clean: - rm -f dmc-pop3 dmc-imap4 dmc-smtp *.o + rm -f dmc-pop3 dmc-imap4 dmc-smtp dmc-pack *.o loc: sloccount . diff --git a/pack.c b/pack.c @@ -9,7 +9,7 @@ static const char cb64[]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; static const char cd64[]="|$$$}rstuvwxyz{$$$$$$$>?@ABCDEFGHIJKLMNOPQRSTUVW$$$$$$XYZ[\\]^_`abcdefghijklmnopq"; -void b64_encode(unsigned char in[3], unsigned char out[4], int len) +void b64_encode(char in[3], char out[4], int len) { out[0] = cb64[ in[0] >> 2 ]; out[1] = cb64[ ((in[0] & 0x03) << 4) | ((in[1] & 0xf0) >> 4) ]; @@ -17,7 +17,7 @@ void b64_encode(unsigned char in[3], unsigned char out[4], int len) out[3] = (len > 2 ? cb64[ in[2] & 0x3f ] : '='); } -int b64_decode(unsigned char in[4], unsigned char out[3]) +int b64_decode(char in[4], char out[3]) { unsigned char v[4]; int len = 3, i; @@ -78,7 +78,7 @@ int mime_unpack() filename[strlen(filename)-2] = '\0'; printf("%s\n", filename); } else if (b[0] == '\n') { - if (!dump && filename && (fd = fopen(filename, "w"))) + if (!dump && filename[0] && (fd = fopen(filename, "w"))) dump = 1; else dump = 0; } else if (dump) { @@ -98,8 +98,6 @@ int mime_unpack() int main(int argc, char **argv) { - int i; - if(argc < 2 || !strcmp(argv[1], "-h")) printf("usage: %s [-uh | attachment1 attachment2...]\n", argv[0]); else if(!strcmp(argv[1], "-u"))