X-Git-Url: https://git.deb.at/?a=blobdiff_plain;f=filter.c;h=9f57ee95af5078317ef4e5254b4abdd608124037;hb=079c2d798d85c2711642d41862b67eb459a182ae;hp=880213a7d00a352d5ae08a55b8b7388991dfd6e9;hpb=a90741d557657908af185630d637c043795d9375;p=pkg%2Fabook.git diff --git a/filter.c b/filter.c index 880213a..9f57ee9 100644 --- a/filter.c +++ b/filter.c @@ -140,7 +140,7 @@ get_real_name() pwent = getpwnam(username); - if( (tmp = (char *)malloc(strlen(pwent->pw_gecos) +1)) == NULL) + if((tmp = strdup(pwent->pw_gecos)) == NULL) return strdup(username); rtn = sscanf(pwent->pw_gecos, "%[^,]", tmp); @@ -640,15 +640,15 @@ mutt_read_line(FILE *in, char **alias, char **rest) while( ! ISSPACE(*ptr) ) ptr++; - if( (*alias = (char *)malloc(ptr-tmp+1)) == NULL) { + if( (*alias = (char *)malloc(ptr - tmp)) == NULL) { free(line); return 1; } - strncpy(*alias, tmp, ptr-tmp); - *(*alias + (ptr - tmp)) = 0; + strncpy(*alias, tmp, ptr - tmp - 1); + *(*alias + (ptr - tmp - 1)) = 0; - while( ISSPACE(*ptr) ) + while(ISSPACE(*ptr)) ptr++; *rest = strdup(ptr); @@ -657,14 +657,38 @@ mutt_read_line(FILE *in, char **alias, char **rest) return 0; } +static void +mutt_fix_quoting(char *p) +{ + char *escape = 0; + + for(; *p; p++) { + switch(*p) { + case '\"': + if(escape) + *escape = ' '; + break; + case '\\': + escape = p; + break; + default: + escape = 0; + } + } +} + static void mutt_parse_email(list_item item) { char *line = item[NAME]; - char *start = line, *tmp; + char *tmp; char *name, *email; +#if 0 + char *start = line; int i = 0; +#endif + mutt_fix_quoting(line); tmp = strconcat("From: ", line, NULL); getname(tmp, &name, &email); free(tmp); @@ -678,6 +702,10 @@ mutt_parse_email(list_item item) else return; + /* + * this is completely broken + */ +#if 0 while( (start = strchr(start, ',')) && i++ < MAX_EMAILS - 1) { tmp = strconcat("From: ", ++start, NULL); getname(tmp, &name, &email); @@ -693,6 +721,7 @@ mutt_parse_email(list_item item) } } } +#endif } static int