From: Kevin McCarthy Date: Tue, 1 Jan 2019 00:06:53 +0000 (-0800) Subject: Remove trailing whitespace. X-Git-Tag: mutt-1-12-rel~146 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=443295ee65c3ebc5085fcab3cc9d533b0fac4f0f;p=mutt Remove trailing whitespace. The result of find . -name "*.[ch]" -exec emacs -batch {} \ --eval="(progn (delete-trailing-whitespace) (and (buffer-modified-p) (save-buffer)))" \; --- diff --git a/account.c b/account.c index 0cfea974..31636adc 100644 --- a/account.c +++ b/account.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2007 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* remote host account manipulation (POP/IMAP) */ @@ -50,7 +50,7 @@ int mutt_account_match (const ACCOUNT* a1, const ACCOUNT* a2) if (a1->type == MUTT_ACCT_TYPE_POP && PopUser) user = PopUser; #endif - + if (a1->flags & a2->flags & MUTT_ACCT_USER) return (!strcmp (a1->user, a2->user)); if (a1->flags & MUTT_ACCT_USER) @@ -306,7 +306,7 @@ char* mutt_account_getoauthbearer (ACCOUNT* account) /* Determine the length of the keyed message digest, add 50 for * overhead. */ - oalen = strlen (account->login) + strlen (account->host) + strlen (token) + 50; + oalen = strlen (account->login) + strlen (account->host) + strlen (token) + 50; oauthbearer = safe_malloc (oalen); snprintf (oauthbearer, oalen, diff --git a/account.h b/account.h index dd9683e2..943da839 100644 --- a/account.h +++ b/account.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2007,2012 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* remote host account manipulation (POP/IMAP) */ diff --git a/addrbook.c b/addrbook.c index f6d96130..12bcaa11 100644 --- a/addrbook.c +++ b/addrbook.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2007 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -87,9 +87,9 @@ static int alias_tag (MUTTMENU *menu, int n, int m) { ALIAS *cur = ((ALIAS **) menu->data)[n]; int ot = cur->tagged; - + cur->tagged = (m >= 0 ? m : !cur->tagged); - + return cur->tagged - ot; } @@ -115,7 +115,7 @@ static int alias_SortAddress (const void *a, const void *b) else if (pb == NULL) r = 1; else if (pa->personal) - { + { if (pb->personal) r = mutt_strcasecmp (pa->personal, pb->personal); else @@ -139,7 +139,7 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases) char helpstr[LONG_STRING]; int omax; - + if (!aliases) { mutt_error _("You have no aliases!"); @@ -156,7 +156,7 @@ void mutt_alias_menu (char *buf, size_t buflen, ALIAS *aliases) new_aliases: omax = menu->max; - + /* count the number of aliases */ for (aliasp = aliases; aliasp; aliasp = aliasp->next) { @@ -190,7 +190,7 @@ new_aliases: aliases = aliases->next; goto new_aliases; } - + switch ((op = mutt_menuLoop (menu))) { case OP_DELETE: @@ -238,5 +238,5 @@ new_aliases: mutt_pop_current_menu (menu); mutt_menuDestroy (&menu); FREE (&AliasTable); - + } diff --git a/alias.c b/alias.c index da1db062..62b54edc 100644 --- a/alias.c +++ b/alias.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -44,7 +44,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS *a, LIST **expn) LIST *u; char i; const char *fqdn; - + while (a) { if (!a->group && !a->personal && a->mailbox && strchr (a->mailbox, '@') == NULL) @@ -52,7 +52,7 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS *a, LIST **expn) t = mutt_lookup_alias (a->mailbox); if (t) - { + { i = 0; for (u = *expn; u; u = u->next) { @@ -92,10 +92,10 @@ static ADDRESS *mutt_expand_aliases_r (ADDRESS *a, LIST **expn) if (pw) { char namebuf[STRING]; - + mutt_gecos_name (namebuf, sizeof (namebuf), pw); mutt_str_replace (&a->personal, namebuf); - + #ifdef EXACT_ADDRESS FREE (&a->val); #endif @@ -144,7 +144,7 @@ void mutt_expand_aliases_env (ENVELOPE *env) } -/* +/* * if someone has an address like * From: Michael `/bin/rm -f ~` Elkins * and the user creates an alias for this, Mutt could wind up executing @@ -157,10 +157,10 @@ void mutt_expand_aliases_env (ENVELOPE *env) * since that would get aliased as * alias me Michael \\`/bin/rm -f ~\\` Elkins * which still gets evaluated because the double backslash is not a quote. - * + * * Additionally, we need to quote ' and " characters - otherwise, mutt will * interpret them on the wrong parsing step. - * + * * $ wants to be quoted since it may indicate the start of an environment * variable. */ @@ -254,7 +254,7 @@ void mutt_create_alias (ENVELOPE *cur, ADDRESS *iadr) /* Don't suggest a bad alias name in the event of a strange local part. */ mutt_check_alias_name (tmp, buf, sizeof (buf)); - + retry_name: /* L10N: prompt to add a new alias */ if (mutt_get_field (_("Alias as: "), buf, sizeof (buf), 0) != 0 || !buf[0]) @@ -266,7 +266,7 @@ retry_name: mutt_error _("You already have an alias defined with that name!"); return; } - + if (mutt_check_alias_name (buf, fixed, sizeof (fixed))) { switch (mutt_yesorno (_("Warning: This alias name may not work. Fix it?"), MUTT_YES)) @@ -274,24 +274,24 @@ retry_name: case MUTT_YES: strfcpy (buf, fixed, sizeof (buf)); goto retry_name; - case -1: + case -1: return; } } - + new = safe_calloc (1, sizeof (ALIAS)); new->self = new; new->name = safe_strdup (buf); mutt_addrlist_to_local (adr); - + if (adr) strfcpy (buf, adr->mailbox, sizeof (buf)); else buf[0] = 0; mutt_addrlist_to_intl (adr, NULL); - + do { if (mutt_get_field (_("Address: "), buf, sizeof (buf), 0) != 0 || !buf[0]) @@ -299,7 +299,7 @@ retry_name: mutt_free_alias (&new); return; } - + if((new->addr = rfc822_parse_adrlist (new->addr, buf)) == NULL) BEEP (); if (mutt_addrlist_to_intl (new->addr, &err)) @@ -311,7 +311,7 @@ retry_name: } } while(new->addr == NULL); - + if (adr && adr->personal && !mutt_is_mail_list (adr)) strfcpy (buf, adr->personal, sizeof (buf)); else @@ -334,7 +334,7 @@ retry_name: } mutt_alias_add_reverse (new); - + if ((t = Aliases)) { while (t->next) @@ -387,14 +387,14 @@ retry_name: mutt_perror (buf); return; - + fseek_err: mutt_perror (_("Error seeking in alias file")); safe_fclose (&rc); return; } -/* +/* * Sanity-check an alias name: Only characters which are non-special to both * the RFC 822 and the mutt configuration parser are permitted. */ @@ -448,7 +448,7 @@ ADDRESS *alias_reverse_lookup (ADDRESS *a) { if (!a || !a->mailbox) return NULL; - + return hash_find (ReverseAlias, a->mailbox); } @@ -579,10 +579,10 @@ int mutt_alias_complete (char *s, size_t buflen) a_list->next = a_cur->next; else Aliases = a_cur->next; - + a_cur->next = NULL; mutt_free_alias (&a_cur); - + if (a_list) a_cur = a_list; else @@ -594,18 +594,18 @@ int mutt_alias_complete (char *s, size_t buflen) a_cur = a_cur->next; } } - + return 0; } static int string_is_address(const char *str, const char *u, const char *d) { char buf[LONG_STRING]; - + snprintf(buf, sizeof(buf), "%s@%s", NONULL(u), NONULL(d)); if (ascii_strcasecmp(str, buf) == 0) return 1; - + return 0; } @@ -663,7 +663,7 @@ int mutt_addr_is_user (ADDRESS *addr) else return 1; } - + dprint (5, (debugfile, "mutt_addr_is_user: no, all failed.\n")); return 0; } diff --git a/ascii.c b/ascii.c index 45f7e5d0..15f685e8 100644 --- a/ascii.c +++ b/ascii.c @@ -1,27 +1,27 @@ /* * Copyright (C) 2001 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * */ -/* +/* * Versions of the string comparison functions which are * locale-insensitive. */ @@ -48,7 +48,7 @@ inline int ascii_toupper (int c) { if (ascii_islower (c)) return c & ~32; - + return c; } @@ -56,21 +56,21 @@ inline int ascii_tolower (int c) { if (ascii_isupper (c)) return c | 32; - + return c; } int ascii_strcasecmp (const char *a, const char *b) { int i; - + if (a == b) return 0; if (a == NULL && b) return -1; if (b == NULL && a) return 1; - + for (;; a++, b++) { if ((i = ascii_tolower (*a) - ascii_tolower (*b))) @@ -81,26 +81,26 @@ int ascii_strcasecmp (const char *a, const char *b) if (!*a) break; } - + return 0; } int ascii_strncasecmp (const char *a, const char *b, int n) { int i, j; - + if (a == b) return 0; if (a == NULL && b) return -1; if (b == NULL && a) return 1; - + for (j = 0; (*a || *b) && j < n; a++, b++, j++) { if ((i = ascii_tolower (*a) - ascii_tolower (*b))) return i; } - + return 0; } diff --git a/ascii.h b/ascii.h index a4aad748..92730469 100644 --- a/ascii.h +++ b/ascii.h @@ -1,27 +1,27 @@ /* * Copyright (C) 2001-2002 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * */ -/* +/* * Versions of the string comparison functions which are * locale-insensitive. */ diff --git a/attach.c b/attach.c index 94885ec1..004da1d1 100644 --- a/attach.c +++ b/attach.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2002,2013 Michael R. Elkins * Copyright (C) 1999-2004,2006 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -50,7 +50,7 @@ int mutt_get_tmp_attachment (BODY *a) rfc1524_entry *entry = NULL; FILE *fpin = NULL, *fpout = NULL; struct stat st; - + if(a->unlink) return 0; @@ -81,12 +81,12 @@ int mutt_get_tmp_attachment (BODY *a) } else mutt_perror(fpin ? mutt_b2s (tempfile) : a->filename); - + if(fpin) safe_fclose (&fpin); if(fpout) safe_fclose (&fpout); mutt_buffer_pool_release (&tempfile); - + return a->unlink ? 0 : -1; } @@ -109,7 +109,7 @@ int mutt_compose_attachment (BODY *a) { if (entry->composetypecommand) mutt_buffer_strcpy (command, entry->composetypecommand); - else + else mutt_buffer_strcpy (command, entry->composecommand); if (mutt_buffer_rfc1524_expand_filename (entry->nametemplate, @@ -127,7 +127,7 @@ int mutt_compose_attachment (BODY *a) } else mutt_buffer_strcpy (newfile, a->filename); - + if (mutt_buffer_rfc1524_expand_command (a, mutt_b2s (newfile), type, command)) { @@ -141,7 +141,7 @@ int mutt_compose_attachment (BODY *a) mutt_endwin (NULL); if ((r = mutt_system (mutt_b2s (command))) == -1) mutt_error (_("Error running \"%s\"!"), mutt_b2s (command)); - + if (r != -1 && entry->composetypecommand) { BODY *b; @@ -174,7 +174,7 @@ int mutt_compose_attachment (BODY *a) b->form_name = NULL; } - /* Remove headers by copying out data to another file, then + /* Remove headers by copying out data to another file, then * copying the file back */ fseeko (fp, b->offset, 0); mutt_buffer_mktemp (tempfile); @@ -186,8 +186,8 @@ int mutt_compose_attachment (BODY *a) mutt_copy_stream (fp, tfp); safe_fclose (&fp); safe_fclose (&tfp); - mutt_unlink (a->filename); - if (mutt_rename_file (mutt_b2s (tempfile), a->filename) != 0) + mutt_unlink (a->filename); + if (mutt_rename_file (mutt_b2s (tempfile), a->filename) != 0) { mutt_perror _("Failure to rename file."); goto bailout; @@ -222,8 +222,8 @@ bailout: return rc; } -/* - * Currently, this only works for send mode, as it assumes that the +/* + * Currently, this only works for send mode, as it assumes that the * BODY->filename actually contains the information. I'm not sure * we want to deal with editing attachments we've already received, * so this should be ok. @@ -294,15 +294,15 @@ int mutt_edit_attachment (BODY *a) } rc = 1; - + bailout: - + if(unlink_newfile) unlink(mutt_b2s (newfile)); mutt_buffer_pool_release (&command); mutt_buffer_pool_release (&newfile); - + rfc1524_free_entry (&entry); return rc; } @@ -315,7 +315,7 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) for (; t; t = t->next) { i = mutt_strlen (t->data) - 1; - if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && + if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) { @@ -332,12 +332,12 @@ void mutt_check_lookup_list (BODY *b, char *type, int len) n == TYPETEXT ? "text" : n == TYPEVIDEO ? "video" : "other", tmp.subtype); - dprint(1, (debugfile, "mutt_check_lookup_list: \"%s\" -> %s\n", + dprint(1, (debugfile, "mutt_check_lookup_list: \"%s\" -> %s\n", b->filename, type)); } - if (tmp.subtype) + if (tmp.subtype) FREE (&tmp.subtype); - if (tmp.xtype) + if (tmp.xtype) FREE (&tmp.xtype); } } @@ -360,7 +360,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, rfc1524_entry *entry = NULL; int rc = -1; int unlink_tempfile = 0; - + is_message = mutt_is_message_type(a->type, a->subtype); if (WithCrypto && is_message && a->hdr && (a->hdr->security & ENCRYPT) && !crypt_valid_passphrase(a->hdr->security)) @@ -373,10 +373,10 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, use_mailcap = (flag == MUTT_MAILCAP || (flag == MUTT_REGULAR && mutt_needs_mailcap (a))); snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - + if (use_mailcap) { - entry = rfc1524_new_entry (); + entry = rfc1524_new_entry (); if (!rfc1524_mailcap_lookup (a, type, entry, 0)) { if (flag == MUTT_REGULAR) @@ -391,7 +391,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, goto return_error; } } - + if (use_mailcap) { if (!entry->command) @@ -400,7 +400,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, goto return_error; } mutt_buffer_strcpy (command, entry->command); - + if (fp) { fname = safe_strdup (a->filename); @@ -428,7 +428,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, } else if (fp == NULL) /* send case */ mutt_buffer_strcpy (tempfile, a->filename); - + if (fp) { /* recv case: we need to save the attachment to a file */ @@ -441,7 +441,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, command); use_pager = entry->copiousoutput; } - + if (use_pager) { if (fp && !use_mailcap && a->filename) @@ -453,12 +453,12 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, else mutt_buffer_mktemp (pagerfile); } - + if (use_mailcap) { pid_t thepid = 0; int tempfd = -1, pagerfd = -1; - + if (!use_pager) mutt_endwin (NULL); @@ -482,7 +482,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, { if(pagerfd != -1) close(pagerfd); - + if(tempfd != -1) close(tempfd); @@ -577,7 +577,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, } unset_option (OPTVIEWATTACH); } - + if (a->description) strfcpy (descrip, a->description, sizeof (descrip)); else if (a->filename) @@ -586,13 +586,13 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, else snprintf (descrip, sizeof (descrip), _("---Attachment: %s"), type); } - + /* We only reach this point if there have been no errors */ if (use_pager) { pager_t info; - + memset (&info, 0, sizeof (info)); info.fp = fp; info.bdy = a; @@ -608,7 +608,7 @@ int mutt_view_attachment (FILE *fp, BODY *a, int flag, HEADER *hdr, rc = 0; return_error: - + if (entry) rfc1524_free_entry (&entry); if (fp && (mutt_b2s (tempfile))[0]) @@ -632,7 +632,7 @@ int mutt_pipe_attachment (FILE *fp, BODY *b, const char *path, char *outfile) pid_t thepid; int out = -1; int rv = 0; - + if (outfile && *outfile) if ((out = safe_open (outfile, O_CREAT | O_EXCL | O_WRONLY)) < 0) { @@ -662,7 +662,7 @@ int mutt_pipe_attachment (FILE *fp, BODY *b, const char *path, char *outfile) mutt_perror _("Can't create filter"); goto bail; } - + s.fpin = fp; mutt_decode_attachment (b, &s); safe_fclose (&s.fpout); @@ -695,16 +695,16 @@ int mutt_pipe_attachment (FILE *fp, BODY *b, const char *path, char *outfile) safe_fclose (&ifp); goto bail; } - + mutt_copy_stream (ifp, ofp); safe_fclose (&ofp); safe_fclose (&ifp); } rv = 1; - + bail: - + if (outfile && *outfile) close (out); @@ -726,7 +726,7 @@ mutt_save_attachment_open (const char *path, int flags) return fopen (path, "a"); if (flags == MUTT_SAVE_OVERWRITE) return fopen (path, "w"); /* __FOPEN_CHECKED__ */ - + return safe_fopen (path, "w"); } @@ -735,7 +735,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER { if (fp) { - + /* recv mode */ if(hdr && @@ -752,7 +752,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER MESSAGE *msg; int chflags = 0; int r = -1; - + hn = m->hdr; hn->msgno = hdr->msgno; /* required for MH/maildir */ hn->read = 1; @@ -770,7 +770,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER if (ctx.magic == MUTT_MBOX || ctx.magic == MUTT_MMDF) chflags = CH_FROM | CH_UPDATE_LEN; chflags |= (ctx.magic == MUTT_MAILDIR ? CH_NOSTATUS : CH_UPDATE); - if (_mutt_copy_message (msg->fp, fp, hn, hn->content, 0, chflags) == 0 + if (_mutt_copy_message (msg->fp, fp, hn, hn->content, 0, chflags) == 0 && mx_commit_message (msg, &ctx) == 0) r = 0; else @@ -783,9 +783,9 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER else { /* In recv mode, extract from folder and decode */ - + STATE s; - + memset (&s, 0, sizeof (s)); if ((s.fpout = mutt_save_attachment_open (path, flags)) == NULL) { @@ -795,7 +795,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER } fseeko ((s.fpin = fp), m->offset, 0); mutt_decode_attachment (m, &s); - + if (fclose (s.fpout) != 0) { mutt_perror ("fclose"); @@ -815,7 +815,7 @@ int mutt_save_attachment (FILE *fp, BODY *m, const char *path, int flags, HEADER mutt_perror ("fopen"); return (-1); } - + if ((nfp = mutt_save_attachment_open (path, flags)) == NULL) { mutt_perror ("fopen"); @@ -884,7 +884,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, const char *path, saved_encoding = m->encoding; if (!is_multipart (m)) m->encoding = ENC8BIT; - + m->length = st.st_size; m->offset = 0; saved_parts = m->parts; @@ -922,7 +922,7 @@ int mutt_decode_save_attachment (FILE *fp, BODY *m, const char *path, /* Ok, the difference between send and receive: * recv: BODY->filename is a suggested name, and Context|HEADER points * to the attachment in mailbox which is encoded - * send: BODY->filename points to the un-encoded file which contains the + * send: BODY->filename points to the un-encoded file which contains the * attachment */ @@ -938,13 +938,13 @@ int mutt_print_attachment (FILE *fp, BODY *a) snprintf (type, sizeof (type), "%s/%s", TYPE (a), a->subtype); - if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT)) + if (rfc1524_mailcap_lookup (a, type, NULL, MUTT_PRINT)) { rfc1524_entry *entry; int piped = FALSE; dprint (2, (debugfile, "Using mailcap...\n")); - + entry = rfc1524_new_entry (); rfc1524_mailcap_lookup (a, type, entry, MUTT_PRINT); if (mutt_buffer_rfc1524_expand_filename (entry->nametemplate, a->filename, @@ -1030,10 +1030,10 @@ int mutt_print_attachment (FILE *fp, BODY *a) mutt_buffer_mktemp (newfile); if (mutt_decode_save_attachment (fp, a, mutt_b2s (newfile), MUTT_PRINTING, 0) == 0) { - + dprint (2, (debugfile, "successfully decoded %s type attachment to %s\n", type, mutt_b2s (newfile))); - + if ((ifp = fopen (mutt_b2s (newfile), "r")) == NULL) { mutt_perror ("fopen"); @@ -1041,7 +1041,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) } dprint (2, (debugfile, "successfully opened %s read-only\n", mutt_b2s (newfile))); - + mutt_endwin (NULL); if ((thepid = mutt_create_filter (NONULL(PrintCmd), &fpout, NULL, NULL)) < 0) { @@ -1050,7 +1050,7 @@ int mutt_print_attachment (FILE *fp, BODY *a) } dprint (2, (debugfile, "Filter created.\n")); - + mutt_copy_stream (ifp, fpout); safe_fclose (&fpout); diff --git a/attach.h b/attach.h index 84b1fd24..7ac0e5a5 100644 --- a/attach.h +++ b/attach.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* common protos for compose / attach menus */ diff --git a/base64.c b/base64.c index 120d4baa..4e772ee1 100644 --- a/base64.c +++ b/base64.c @@ -4,39 +4,39 @@ * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free - * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - * + * */ -/* +/* * Base64 handling elsewhere in mutt should be modified to call * these routines. These routines were written because IMAP's * AUTHENTICATE protocol required them, and base64 handling * elsewhere wasn't sufficiently generic. - * + * */ -/* +/* * This code is heavily modified from fetchmail (also GPL'd, of * course) by Brendan Cully . - * + * * Original copyright notice: - * + * * The code in the fetchmail distribution is Copyright 1997 by Eric * S. Raymond. Portions are also copyrighted by Carl Harris, 1993 * and 1995. Copyright retained for the purpose of protecting free - * redistribution of source. - * + * redistribution of source. + * */ #if HAVE_CONFIG_H diff --git a/browser.c b/browser.c index c7e58b68..bd878910 100644 --- a/browser.c +++ b/browser.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -157,9 +157,9 @@ static int link_is_dir (const char *folder, const char *path) { struct stat st; char fullpath[_POSIX_PATH_MAX]; - + mutt_concat_path (fullpath, folder, path, sizeof (fullpath)); - + if (stat (fullpath, &st) == 0) return (S_ISDIR (st.st_mode)); else @@ -185,7 +185,7 @@ folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, co snprintf (tmp, sizeof (tmp), "%%%sd", fmt); snprintf (dest, destlen, tmp, folder->num + 1); break; - + case 'd': case 'D': if (folder->ff->local) @@ -214,7 +214,7 @@ folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, co else mutt_format_s (dest, destlen, fmt, ""); break; - + case 'f': { char *s; @@ -229,7 +229,7 @@ folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, co folder->ff->local ? (S_ISLNK (folder->ff->mode) ? "@" : (S_ISDIR (folder->ff->mode) ? "/" : ((folder->ff->mode & S_IXUSR) != 0 ? "*" : ""))) : ""); - + mutt_format_s (dest, destlen, fmt, fn); break; } @@ -256,12 +256,12 @@ folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, co snprintf (permission, sizeof (permission), "IMAP %c", (folder->ff->inferiors && folder->ff->selectable) ? '+' : ' '); mutt_format_s (dest, destlen, fmt, permission); - } + } #endif else mutt_format_s (dest, destlen, fmt, ""); break; - + case 'g': if (folder->ff->local) { @@ -276,7 +276,7 @@ folder_format_str (char *dest, size_t destlen, size_t col, int cols, char op, co else mutt_format_s (dest, destlen, fmt, ""); break; - + case 'l': if (folder->ff->local) { @@ -389,7 +389,7 @@ static void add_folder (MUTTMENU *m, struct browser_state *state, (state->entry)[state->entrylen].gid = s->st_gid; (state->entry)[state->entrylen].uid = s->st_uid; (state->entry)[state->entrylen].nlink = s->st_nlink; - + (state->entry)[state->entrylen].local = 1; } @@ -467,7 +467,7 @@ static int examine_directory (MUTTMENU *menu, struct browser_state *state, { if (mutt_strcmp (de->d_name, ".") == 0) continue; /* we don't need . */ - + if (prefix && *prefix && mutt_strncmp (prefix, de->d_name, mutt_strlen (prefix)) != 0) continue; if (!((regexec (Mask.rx, de->d_name, 0, NULL, 0) == 0) ^ Mask.not)) @@ -476,13 +476,13 @@ static int examine_directory (MUTTMENU *menu, struct browser_state *state, mutt_concat_path (buffer, d, de->d_name, sizeof (buffer)); if (lstat (buffer, &s) == -1) continue; - + /* No size for directories or symlinks */ if (S_ISDIR (s.st_mode) || S_ISLNK (s.st_mode)) s.st_size = 0; else if (! S_ISREG (s.st_mode)) continue; - + tmp = Incoming; while (tmp && mutt_strcmp (buffer, tmp->path)) tmp = tmp->next; @@ -494,7 +494,7 @@ static int examine_directory (MUTTMENU *menu, struct browser_state *state, } add_folder (menu, state, de->d_name, &s, tmp); } - closedir (dp); + closedir (dp); browser_sort (state); return 0; } @@ -578,8 +578,8 @@ static void folder_entry (char *s, size_t slen, MUTTMENU *menu, int num) folder.ff = &((struct folder_file *) menu->data)[num]; folder.num = num; - - mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str, + + mutt_FormatString (s, slen, 0, MuttIndexWindow->cols, NONULL(FolderFormat), folder_format_str, (unsigned long) &folder, MUTT_FORMAT_ARROWCURSOR); } @@ -598,7 +598,7 @@ static void init_menu (struct browser_state *state, MUTTMENU *menu, char *title, menu->top = 0; menu->tagged = 0; - + if (buffy) snprintf (title, titlelen, _("Mailboxes [%d]"), mutt_buffy_check (0)); else @@ -626,10 +626,10 @@ static int file_tag (MUTTMENU *menu, int n, int m) mutt_error _("Can't attach a directory!"); return 0; } - + ot = ff->tagged; ff->tagged = (m >= 0 ? m : !ff->tagged); - + return ff->tagged - ot; } @@ -648,7 +648,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num int buffy = (flags & MUTT_SEL_BUFFY) ? 1 : 0; buffy = buffy && folder; - + memset (&state, 0, sizeof (struct browser_state)); if (!folder) @@ -701,13 +701,13 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num } #endif } - else + else { if (!folder) getcwd (LastDir, sizeof (LastDir)); else if (!LastDir[0]) strfcpy (LastDir, NONULL(Maildir), sizeof (LastDir)); - + #ifdef USE_IMAP if (!buffy && mx_is_imap (LastDir)) { @@ -769,7 +769,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num if (S_ISDIR (state.entry[menu->current].mode) || (S_ISLNK (state.entry[menu->current].mode) && - link_is_dir (LastDir, state.entry[menu->current].name)) + link_is_dir (LastDir, state.entry[menu->current].name)) #ifdef USE_IMAP || state.entry[menu->current].inferiors #endif @@ -830,12 +830,12 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { int n; ciss_url_t url; - + strfcpy (LastDir, state.entry[menu->current].name, sizeof (LastDir)); /* tack on delimiter here */ n = strlen (LastDir)+1; - + /* special case "" needs no delimiter */ url_parse_ciss (&url, state.entry[menu->current].name); if (url.path && @@ -882,8 +882,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num goto bail; } } - menu->current = 0; - menu->top = 0; + menu->current = 0; + menu->top = 0; init_menu (&state, menu, title, sizeof (title), buffy); break; } @@ -980,8 +980,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num imap_browse (LastDir, &state); browser_sort (&state); menu->data = state.entry; - menu->current = 0; - menu->top = 0; + menu->current = 0; + menu->top = 0; init_menu (&state, menu, title, sizeof (title), buffy); } /* else leave error on screen */ @@ -1052,7 +1052,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num } break; #endif - + case OP_CHANGE_DIRECTORY: strfcpy (buf, LastDir, sizeof (buf)); @@ -1069,7 +1069,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num if (mutt_get_field (_("Chdir to: "), buf, sizeof (buf), MUTT_FILE) == 0 && buf[0]) { - buffy = 0; + buffy = 0; mutt_expand_path (buf, sizeof (buf)); #ifdef USE_IMAP if (mx_is_imap (buf)) @@ -1081,8 +1081,8 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num imap_browse (LastDir, &state); browser_sort (&state); menu->data = state.entry; - menu->current = 0; - menu->top = 0; + menu->current = 0; + menu->top = 0; init_menu (&state, menu, title, sizeof (title), buffy); } else @@ -1123,7 +1123,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num } } break; - + case OP_ENTER_MASK: strfcpy (buf, NONULL(Mask.pattern), sizeof (buf)); @@ -1195,7 +1195,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { int resort = 1; int reverse = (i == OP_SORT_REVERSE); - + switch (mutt_multi_choice ((reverse) ? _("Reverse sort by (d)ate, (a)lpha, si(z)e, (c)ount, (u)nread, or do(n)'t sort? ") : _("Sort by (d)ate, (a)lpha, si(z)e, (c)ount, (u)nread, or do(n)'t sort? "), @@ -1304,12 +1304,12 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num { mutt_error _("Can't view a directory"); break; - } + } else { BODY *b; char buf[_POSIX_PATH_MAX]; - + mutt_concat_path (buf, LastDir, state.entry[menu->current].name, sizeof (buf)); b = mutt_make_file_attach (buf); if (b != NULL) @@ -1323,7 +1323,7 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num } } } - + bail: if (menu) @@ -1334,5 +1334,5 @@ void _mutt_select_file (char *f, size_t flen, int flags, char ***files, int *num if (!folder) strfcpy (LastDir, LastDirBackup, sizeof (LastDir)); - + } diff --git a/browser.h b/browser.h index 67e62eae..a7103743 100644 --- a/browser.h +++ b/browser.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _BROWSER_H #define _BROWSER_H 1 diff --git a/buffy.c b/buffy.c index b231f0cd..d6586121 100644 --- a/buffy.c +++ b/buffy.c @@ -1,17 +1,17 @@ -/* +/* * Copyright (C) 1996-2000,2010,2013 Michael R. Elkins * Copyright (C) 2016-2017 Kevin J. McCarthy - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -58,7 +58,7 @@ static short BuffyNotify = 0; /* # of unnotified new boxes */ static BUFFY* buffy_get (const char *path); -/* Find the last message in the file. +/* Find the last message in the file. * upon success return 0. If no message found - return -1 */ static int fseek_last_message (FILE * f) @@ -176,7 +176,7 @@ void mutt_buffy_cleanup (const char *buf, struct stat *st) #else ut.actime = st->st_atime; ut.modtime = time (NULL); - utime (buf, &ut); + utime (buf, &ut); #endif } else @@ -199,13 +199,13 @@ BUFFY *mutt_find_mailbox (const char *path) BUFFY *tmp = NULL; struct stat sb; struct stat tmp_sb; - + if (stat (path,&sb) != 0) return NULL; for (tmp = Incoming; tmp; tmp = tmp->next) { - if (stat (tmp->path,&tmp_sb) ==0 && + if (stat (tmp->path,&tmp_sb) ==0 && sb.st_dev == tmp_sb.st_dev && sb.st_ino == tmp_sb.st_ino) break; } @@ -568,7 +568,7 @@ int mutt_buffy_check (int force) contex_sb.st_dev=0; contex_sb.st_ino=0; } - + for (tmp = Incoming; tmp; tmp = tmp->next) { #ifdef USE_SIDEBAR @@ -654,7 +654,7 @@ int mutt_buffy_list (void) int first = 1; int have_unnotified = BuffyNotify; - + buffylist[0] = 0; pos += strlen (strncat (buffylist, _("New mail in "), sizeof (buffylist) - 1 - pos)); /* __STRNCAT_CHECKED__ */ for (tmp = Incoming; tmp; tmp = tmp->next) @@ -665,11 +665,11 @@ int mutt_buffy_list (void) strfcpy (path, tmp->path, sizeof (path)); mutt_pretty_mailbox (path, sizeof (path)); - + if (!first && (MuttMessageWindow->cols >= 7) && (pos + strlen (path) >= (size_t)MuttMessageWindow->cols - 7)) break; - + if (!first) pos += strlen (strncat(buffylist + pos, ", ", sizeof(buffylist)-1-pos)); /* __STRNCAT_CHECKED__ */ @@ -692,7 +692,7 @@ int mutt_buffy_list (void) mutt_message ("%s", buffylist); return (1); } - /* there were no mailboxes needing to be notified, so clean up since + /* there were no mailboxes needing to be notified, so clean up since * BuffyNotify has somehow gotten out of sync */ BuffyNotify = 0; @@ -725,7 +725,7 @@ int mutt_buffy_notify (void) return (0); } -/* +/* * mutt_buffy() -- incoming folders completion routine * * given a folder name, this routine gives the next incoming folder with new @@ -738,13 +738,13 @@ void mutt_buffy (char *s, size_t slen) mutt_expand_path (s, slen); - if (mutt_buffy_check (0)) + if (mutt_buffy_check (0)) { for (pass = 0; pass < 2; pass++) - for (tmp = Incoming; tmp; tmp = tmp->next) + for (tmp = Incoming; tmp; tmp = tmp->next) { mutt_expand_path (tmp->path, sizeof (tmp->path)); - if ((found || pass) && tmp->new) + if ((found || pass) && tmp->new) { strfcpy (s, tmp->path, slen); mutt_pretty_mailbox (s, slen); diff --git a/buffy.h b/buffy.h index aecad530..18be9de9 100644 --- a/buffy.h +++ b/buffy.h @@ -1,16 +1,16 @@ -/* +/* * Copyright (C) 1996-2000,2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -21,7 +21,7 @@ /*parameter to mutt_parse_mailboxes*/ #define MUTT_MAILBOXES 1 -#define MUTT_UNMAILBOXES 2 +#define MUTT_UNMAILBOXES 2 typedef struct buffy_t { diff --git a/charset.c b/charset.c index 2411f2cb..9e8efdd6 100644 --- a/charset.c +++ b/charset.c @@ -41,7 +41,7 @@ # define EILSEQ EINVAL #endif -/* +/* * The following list has been created manually from the data under: * http://www.isi.edu/in-notes/iana/assignments/character-sets * Last update: 2000-09-07 @@ -50,12 +50,12 @@ * a preferred MIME name is given. */ -static const struct +static const struct { const char *key; const char *pref; } -PreferredMIMENames[] = +PreferredMIMENames[] = { { "ansi_x3.4-1968", "us-ascii" }, { "iso-ir-6", "us-ascii" }, @@ -66,7 +66,7 @@ PreferredMIMENames[] = { "ibm367", "us-ascii" }, { "cp367", "us-ascii" }, { "csASCII", "us-ascii" }, - + { "csISO2022KR", "iso-2022-kr" }, { "csEUCKR", "euc-kr" }, { "csISO2022JP", "iso-2022-jp" }, @@ -80,14 +80,14 @@ PreferredMIMENames[] = { "IBM819", "iso-8859-1" }, { "CP819", "iso-8859-1" }, { "csISOLatin1", "iso-8859-1" }, - + { "ISO_8859-2:1987", "iso-8859-2" }, { "iso-ir-101", "iso-8859-2" }, { "iso_8859-2", "iso-8859-2" }, { "latin2", "iso-8859-2" }, { "l2", "iso-8859-2" }, { "csISOLatin2", "iso-8859-2" }, - + { "ISO_8859-3:1988", "iso-8859-3" }, { "iso-ir-109", "iso-8859-3" }, { "ISO_8859-3", "iso-8859-3" }, @@ -109,7 +109,7 @@ PreferredMIMENames[] = { "ASMO-708", "iso-8859-6" }, { "arabic", "iso-8859-6" }, { "csISOLatinArabic", "iso-8859-6" }, - + { "ISO_8859-7:1987", "iso-8859-7" }, { "iso-ir-126", "iso-8859-7" }, { "ISO_8859-7", "iso-8859-7" }, @@ -118,7 +118,7 @@ PreferredMIMENames[] = { "greek", "iso-8859-7" }, { "greek8", "iso-8859-7" }, { "csISOLatinGreek", "iso-8859-7" }, - + { "ISO_8859-8:1988", "iso-8859-8" }, { "iso-ir-138", "iso-8859-8" }, { "ISO_8859-8", "iso-8859-8" }, @@ -137,36 +137,36 @@ PreferredMIMENames[] = { "latin5", "iso-8859-9" }, /* this is not a bug */ { "l5", "iso-8859-9" }, { "csISOLatin5", "iso-8859-9" }, - + { "ISO_8859-10:1992", "iso-8859-10" }, { "iso-ir-157", "iso-8859-10" }, { "latin6", "iso-8859-10" }, /* this is not a bug */ { "l6", "iso-8859-10" }, - { "csISOLatin6", "iso-8859-10" }, - + { "csISOLatin6", "iso-8859-10" }, + { "csKOI8r", "koi8-r" }, - + { "MS_Kanji", "Shift_JIS" }, /* Note the underscore! */ { "csShiftJis", "Shift_JIS" }, - + { "Extended_UNIX_Code_Packed_Format_for_Japanese", "euc-jp" }, - { "csEUCPkdFmtJapanese", + { "csEUCPkdFmtJapanese", "euc-jp" }, - + { "csGB2312", "gb2312" }, { "csbig5", "big5" }, - /* + /* * End of official brain damage. What follows has been taken - * from glibc's localedata files. + * from glibc's localedata files. */ { "iso_8859-13", "iso-8859-13" }, { "iso-ir-179", "iso-8859-13" }, { "latin7", "iso-8859-13" }, /* this is not a bug */ { "l7", "iso-8859-13" }, - + { "iso_8859-14", "iso-8859-14" }, { "latin8", "iso-8859-14" }, /* this is not a bug */ { "l8", "iso-8859-14" }, @@ -176,18 +176,18 @@ PreferredMIMENames[] = /* Suggested by Ionel Mugurel Ciobica */ { "latin0", "iso-8859-15" }, /* this is not a bug */ - + { "iso_8859-16", "iso-8859-16" }, { "latin10", "iso-8859-16" }, /* this is not a bug */ - - /* + + /* * David Champion has observed this with - * nl_langinfo under SunOS 5.8. + * nl_langinfo under SunOS 5.8. */ - + { "646", "us-ascii" }, - - /* + + /* * http://www.sun.com/software/white-papers/wp-unicode/ */ @@ -205,11 +205,11 @@ PreferredMIMENames[] = /* * If you happen to encounter system-specific brain-damage with * respect to character set naming, please add it above this - * comment, and submit a patch to . + * comment, and submit a patch to . */ - + /* End of aliases. Please keep this line last. */ - + { NULL, NULL } }; @@ -221,10 +221,10 @@ void mutt_set_langinfo_charset (void) { char buff[LONG_STRING]; char buff2[LONG_STRING]; - + strfcpy (buff, nl_langinfo (CODESET), sizeof (buff)); mutt_canonical_charset (buff2, sizeof (buff2), buff); - + /* finally, set $charset */ if (!(Charset = safe_strdup (buff2))) Charset = safe_strdup ("iso-8859-1"); @@ -388,7 +388,7 @@ iconv_t mutt_iconv_open (const char *tocode, const char *fromcode, int flags) /* call system iconv with names it appreciates */ if ((cd = iconv_open (tocode2, fromcode2)) != (iconv_t) -1) return cd; - + return (iconv_t) -1; } @@ -496,12 +496,12 @@ int mutt_convert_string (char **ps, const char *from, const char *to, int flags) inrepls = repls; else outrepl = "?"; - + len = strlen (s); ib = s, ibl = len + 1; obl = MB_LEN_MAX * ibl; ob = buf = safe_malloc (obl + 1); - + mutt_iconv (cd, &ib, &ibl, &ob, &obl, inrepls, outrepl); iconv_close (cd); @@ -509,7 +509,7 @@ int mutt_convert_string (char **ps, const char *from, const char *to, int flags) FREE (ps); /* __FREE_CHECKED__ */ *ps = buf; - + mutt_str_adjust (ps); return 0; } @@ -574,20 +574,20 @@ char *fgetconvs (char *buf, size_t l, FGETCONV *_fc) { int c; size_t r; - + for (r = 0; r + 1 < l;) { if ((c = fgetconv (_fc)) == EOF) break; buf[r++] = (char) c; - if (c == '\n') + if (c == '\n') break; } buf[r] = '\0'; - - if (r) + + if (r) return buf; - else + else return NULL; } diff --git a/color.c b/color.c index 35318600..836f7c8e 100644 --- a/color.c +++ b/color.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2012 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -123,15 +123,15 @@ static COLOR_LINE *mutt_new_color_line (void) COLOR_LINE *p = safe_calloc (1, sizeof (COLOR_LINE)); p->fg = p->bg = -1; - + return (p); } -static void mutt_free_color_line(COLOR_LINE **l, +static void mutt_free_color_line(COLOR_LINE **l, int free_colors) { COLOR_LINE *tmp; - + if(!l || !*l) return; @@ -145,7 +145,7 @@ static void mutt_free_color_line(COLOR_LINE **l, /* we should really introduce a container * type for regular expressions. */ - + regfree(&tmp->rx); mutt_pattern_free(&tmp->color_pattern); FREE (&tmp->pattern); @@ -194,7 +194,7 @@ static char *get_color_name (char *dest, size_t destlen, int val) case COLOR_WHITE: strfcpy (dest, missing[1], destlen); return dest; - + case COLOR_DEFAULT: strfcpy (dest, missing[2], destlen); return dest; @@ -222,7 +222,7 @@ int mutt_alloc_color (int fg, int bg) { COLOR_LIST *p = ColorList; int i; - + #if defined (USE_SLANG_CURSES) char fgc[SHORT_STRING], bgc[SHORT_STRING]; #endif @@ -402,8 +402,8 @@ parse_color_name (const char *s, int *col, int *attr, int is_fg, BUFFER *err) * unmono index pattern [pattern...] */ -static int -_mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err, +static int +_mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err, short parse_uncolor); @@ -465,7 +465,7 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, if( #ifdef HAVE_COLOR /* we're running without curses */ - option (OPTNOCURSES) + option (OPTNOCURSES) || /* we're parsing an uncolor command, and have no colors */ (parse_uncolor && !has_colors()) /* we're parsing an unmono command, and have colors */ @@ -534,14 +534,14 @@ static int _mutt_parse_uncolor (BUFFER *buf, BUFFER *s, unsigned long data, } -static int +static int add_pattern (COLOR_LINE **top, const char *s, int sensitive, int fg, int bg, int attr, BUFFER *err, int is_index) { /* is_index used to store compiled pattern - * only for `index' color object + * only for `index' color object * when called from mutt_parse_color() */ COLOR_LINE *tmp = *top; @@ -585,7 +585,7 @@ add_pattern (COLOR_LINE **top, const char *s, int sensitive, char buf[LONG_STRING]; tmp = mutt_new_color_line (); - if (is_index) + if (is_index) { strfcpy(buf, NONULL(s), sizeof(buf)); mutt_check_simple (buf, sizeof (buf), NONULL(SimpleSearch)); @@ -632,13 +632,13 @@ parse_object(BUFFER *buf, BUFFER *s, int *o, int *ql, BUFFER *err) { int q_level = 0; char *eptr; - + if(!MoreArgs(s)) { strfcpy(err->data, _("Missing arguments."), err->dsize); return -1; } - + mutt_extract_token(buf, s, 0); if(!mutt_strncmp(buf->data, "quoted", 6)) { @@ -653,7 +653,7 @@ parse_object(BUFFER *buf, BUFFER *s, int *o, int *ql, BUFFER *err) } else *ql = 0; - + *o = MT_COLOR_QUOTED; } else if (!ascii_strcasecmp(buf->data, "compose")) @@ -704,12 +704,12 @@ parse_color_pair(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *er strfcpy (err->data, _("color: too few arguments"), err->dsize); return (-1); } - + mutt_extract_token (buf, s, 0); if (parse_color_name (buf->data, bg, attr, 0, err) != 0) return (-1); - + return 0; } @@ -718,8 +718,8 @@ parse_color_pair(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *er static int parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err) { - - if(fg) *fg = -1; + + if(fg) *fg = -1; if(bg) *bg = -1; if (! MoreArgs (s)) @@ -747,7 +747,7 @@ parse_attr_spec(BUFFER *buf, BUFFER *s, int *fg, int *bg, int *attr, BUFFER *err snprintf (err->data, err->dsize, _("%s: no such attribute"), buf->data); return (-1); } - + return 0; } @@ -761,12 +761,12 @@ static int fgbgattr_to_color(int fg, int bg, int attr) return attr; } -/* usage: color [ ] +/* usage: color [ ] * mono [ ] */ -static int -_mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, +static int +_mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, parser_callback_t callback, short dry_run) { int object = 0, attr = 0, fg = 0, bg = 0, q_level = 0; @@ -779,7 +779,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, return -1; /* extract a regular expression if needed */ - + if (object == MT_COLOR_HEADER || object == MT_COLOR_BODY || object == MT_COLOR_INDEX) { if (!MoreArgs (s)) @@ -790,18 +790,18 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, mutt_extract_token (buf, s, 0); } - + if (MoreArgs (s)) { strfcpy (err->data, _("too many arguments"), err->dsize); return (-1); } - + /* dry run? */ - + if(dry_run) return 0; - + #ifdef HAVE_COLOR # ifdef HAVE_USE_DEFAULT_COLORS if (!option (OPTNOCURSES) && has_colors() @@ -814,7 +814,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, } # endif /* HAVE_USE_DEFAULT_COLORS */ #endif - + if (object == MT_COLOR_HEADER) r = add_pattern (&ColorHdrList, buf->data, 0, fg, bg, attr, err,0); else if (object == MT_COLOR_BODY) @@ -837,7 +837,7 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, if (q_level == 0) { ColorDefs[MT_COLOR_QUOTED] = fgbgattr_to_color(fg, bg, attr); - + ColorQuote[0] = ColorDefs[MT_COLOR_QUOTED]; for (q_level = 1; q_level < ColorQuoteUsed; q_level++) { @@ -859,10 +859,10 @@ _mutt_parse_color (BUFFER *buf, BUFFER *s, BUFFER *err, int mutt_parse_color(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err) { int dry_run = 0; - + if(option(OPTNOCURSES) || !has_colors()) dry_run = 1; - + return _mutt_parse_color(buff, s, err, parse_color_pair, dry_run); } @@ -871,7 +871,7 @@ int mutt_parse_color(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err) int mutt_parse_mono(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err) { int dry_run = 0; - + #ifdef HAVE_COLOR if(option(OPTNOCURSES) || has_colors()) dry_run = 1; @@ -882,4 +882,3 @@ int mutt_parse_mono(BUFFER *buff, BUFFER *s, unsigned long data, BUFFER *err) return _mutt_parse_color(buff, s, err, parse_attr_spec, dry_run); } - diff --git a/commands.c b/commands.c index f0fb0857..7683d184 100644 --- a/commands.c +++ b/commands.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 2000-2004,2006 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -170,14 +170,14 @@ int mutt_display_message (HEADER *cur) } } } - + if (cmflags & MUTT_CM_VERIFY || cur->security & ENCRYPT) { if (cur->security & APPLICATION_PGP) { if (cur->env->from) crypt_pgp_invoke_getkeys (cur->env->from); - + crypt_invoke_message (APPLICATION_PGP); } @@ -193,7 +193,7 @@ int mutt_display_message (HEADER *cur) return (0); } - if (DisplayFilter && *DisplayFilter) + if (DisplayFilter && *DisplayFilter) { fpfilterout = fpout; fpout = NULL; @@ -259,7 +259,7 @@ int mutt_display_message (HEADER *cur) { pager_t info; - if (WithCrypto + if (WithCrypto && (cur->security & APPLICATION_SMIME) && (cmflags & MUTT_CM_VERIFY)) { if (cur->security & GOODSIGN) @@ -275,7 +275,7 @@ int mutt_display_message (HEADER *cur) mutt_error ( _("S/MIME signature could NOT be verified.")); } - if (WithCrypto + if (WithCrypto && (cur->security & APPLICATION_PGP) && (cmflags & MUTT_CM_VERIFY)) { if (cur->security & GOODSIGN) @@ -353,7 +353,7 @@ void ci_bounce_message (HEADER *h) strfcpy(prompt, _("Bounce message to: "), sizeof(prompt)); else strfcpy(prompt, _("Bounce tagged messages to: "), sizeof(prompt)); - + rc = mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS); if (rc || !buf[0]) return; @@ -400,7 +400,7 @@ void ci_bounce_message (HEADER *h) } mutt_window_clearline (MuttMessageWindow, 0); - + rc = mutt_bounce_message (NULL, h, adr); rfc822_free_address (&adr); /* If no error, or background, display message. */ @@ -414,24 +414,24 @@ static void pipe_set_flags (int decode, int print, int *cmflags, int *chflags) { *cmflags |= MUTT_CM_DECODE | MUTT_CM_CHARCONV; *chflags |= CH_DECODE | CH_REORDER; - + if (option (OPTWEED)) { *chflags |= CH_WEED; *cmflags |= MUTT_CM_WEED; } } - + if (print) *cmflags |= MUTT_CM_PRINTING; - + } static void pipe_msg (HEADER *h, FILE *fp, int decode, int print) { int cmflags = 0; int chflags = CH_FROM; - + pipe_set_flags (decode, print, &cmflags, &chflags); if (WithCrypto && decode && h->security & ENCRYPT) @@ -456,14 +456,14 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, int split, char *sep) { - + int i, rc = 0; pid_t thepid; FILE *fpout; - -/* mutt_endwin (NULL); - is this really needed here ? +/* mutt_endwin (NULL); + + is this really needed here ? it makes the screen flicker on pgp and s/mime messages, before asking for a passphrase... Oliver Ehli */ @@ -507,7 +507,7 @@ static int _mutt_pipe_message (HEADER *h, char *cmd, return 1; } } - + if (split) { for (i = 0; i < Context->vcount; i++) @@ -575,7 +575,7 @@ void mutt_pipe_message (HEADER *h) mutt_expand_path (buffer, sizeof (buffer)); _mutt_pipe_message (h, buffer, option (OPTPIPEDECODE), - 0, + 0, option (OPTPIPESPLIT), PipeSep); } @@ -588,7 +588,7 @@ void mutt_print_message (HEADER *h) mutt_message (_("No printing command has been defined.")); return; } - + if (query_quadoption (OPT_PRINT, h ? _("Print message?") : _("Print tagged messages?")) != MUTT_YES) @@ -630,32 +630,32 @@ int mutt_select_sort (int reverse) case 2: /* (f)rm */ Sort = SORT_FROM; break; - + case 3: /* (r)ecv */ Sort = SORT_RECEIVED; break; - + case 4: /* (s)ubj */ Sort = SORT_SUBJECT; break; - + case 5: /* t(o) */ Sort = SORT_TO; break; - + case 6: /* (t)hread */ Sort = SORT_THREADS; break; - + case 7: /* (u)nsort */ Sort = SORT_ORDER; break; - + case 8: /* si(z)e */ Sort = SORT_SIZE; break; - - case 9: /* s(c)ore */ + + case 9: /* s(c)ore */ Sort = SORT_SCORE; break; @@ -733,14 +733,14 @@ void mutt_display_address (ENVELOPE *env) adr = mutt_get_address (env, &pfx); if (!adr) return; - - /* + + /* * Note: We don't convert IDNA to local representation this time. * That is intentional, so the user has an opportunity to copy & * paste the on-the-wire form of the address to other, IDN-unable - * software. + * software. */ - + buf[0] = 0; rfc822_write_address (buf, sizeof (buf), adr, 0); mutt_message ("%s: %s", pfx, buf); @@ -750,7 +750,7 @@ static void set_copy_flags (HEADER *hdr, int decode, int decrypt, int *cmflags, { *cmflags = 0; *chflags = CH_UPDATE_LEN; - + if (WithCrypto && !decode && decrypt && (hdr->security & ENCRYPT)) { if ((WithCrypto & APPLICATION_PGP) @@ -792,7 +792,7 @@ int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int dec { int cmflags, chflags; int rc; - + set_copy_flags (h, decode, decrypt, &cmflags, &chflags); if (decode || decrypt) @@ -808,7 +808,7 @@ int _mutt_save_message (HEADER *h, CONTEXT *ctx, int delete, int decode, int dec if (option (OPTDELETEUNTAG)) mutt_set_flag (Context, h, MUTT_TAG, 0); } - + return 0; } @@ -828,7 +828,7 @@ int mutt_save_message (HEADER *h, int delete, int decode, int decrypt) _("Decrypt-copy%s to mailbox")) : (delete ? _("Save%s to mailbox") : _("Copy%s to mailbox"))), h ? "" : _(" tagged")); - + if (h) { @@ -873,7 +873,7 @@ int mutt_save_message (HEADER *h, int delete, int decode, int decrypt) if (!buf[0]) return (-1); - + /* This is an undocumented feature of ELM pointed out to me by Felix von * Leitner */ @@ -891,11 +891,11 @@ int mutt_save_message (HEADER *h, int delete, int decode, int decrypt) if (WithCrypto && need_passphrase && (decode || decrypt) && !crypt_valid_passphrase(app)) return -1; - + mutt_message (_("Copying to %s..."), buf); - + #ifdef USE_IMAP - if (Context->magic == MUTT_IMAP && + if (Context->magic == MUTT_IMAP && !(decode || decrypt) && mx_is_imap (buf)) { switch (imap_copy_messages (Context, h, buf, delete)) @@ -947,7 +947,7 @@ int mutt_save_message (HEADER *h, int delete, int decode, int decrypt) mutt_clear_error (); return (0); } - + return -1; } @@ -976,7 +976,7 @@ int mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) short charset_changed = 0; short type_changed = 0; short structure_changed = 0; - + cp = mutt_get_parameter ("charset", b->parameter); strfcpy (charset, NONULL (cp), sizeof (charset)); @@ -985,7 +985,7 @@ int mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) if (b->parameter) { size_t l; - + for (p = b->parameter; p; p = p->next) { l = strlen (buf); @@ -994,18 +994,18 @@ int mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) snprintf (buf + l, sizeof (buf) - l, "; %s=%s", p->attribute, tmp); } } - + if (mutt_get_field ("Content-Type: ", buf, sizeof (buf), 0) != 0 || buf[0] == 0) return 0; - + /* clean up previous junk */ mutt_free_parameter (&b->parameter); FREE (&b->subtype); - + mutt_parse_content_type (buf, b); - + snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype)); type_changed = ascii_strcasecmp (tmp, obuf); charset_changed = ascii_strcasecmp (charset, mutt_get_parameter ("charset", b->parameter)); @@ -1022,7 +1022,7 @@ int mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) } /* inform the user */ - + snprintf (tmp, sizeof (tmp), "%s/%s", TYPE (b), NONULL (b->subtype)); if (type_changed) mutt_message (_("Content-Type changed to %s."), tmp); @@ -1054,7 +1054,7 @@ int mutt_edit_content_type (HEADER *h, BODY *b, FILE *fp) structure_changed = 1; mutt_parse_part (fp, b); } - + if (WithCrypto && h) { if (h->content == b) @@ -1071,9 +1071,9 @@ static int _mutt_check_traditional_pgp (HEADER *h, int *redraw) { MESSAGE *msg; int rv = 0; - + h->security |= PGP_TRADITIONAL_CHECKED; - + mutt_parse_mime_message (Context, h); if ((msg = mx_open_message (Context, h->msgno)) == NULL) return 0; @@ -1083,7 +1083,7 @@ static int _mutt_check_traditional_pgp (HEADER *h, int *redraw) *redraw |= REDRAW_FULL; rv = 1; } - + h->security |= PGP_TRADITIONAL_CHECKED; mx_close_message (Context, &msg); return rv; @@ -1098,7 +1098,7 @@ int mutt_check_traditional_pgp (HEADER *h, int *redraw) else { for (i = 0; i < Context->vcount; i++) - if (Context->hdrs[Context->v2r[i]]->tagged && + if (Context->hdrs[Context->v2r[i]]->tagged && !(Context->hdrs[Context->v2r[i]]->security & PGP_TRADITIONAL_CHECKED)) rv = _mutt_check_traditional_pgp (Context->hdrs[Context->v2r[i]], redraw) || rv; diff --git a/complete.c b/complete.c index d0ee4af8..dd598faa 100644 --- a/complete.c +++ b/complete.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2007 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -67,7 +67,7 @@ int mutt_complete (char *s, size_t slen) if (mx_is_imap (imap_path)) return imap_complete (s, slen, imap_path); #endif - + if (*s == '=' || *s == '+' || *s == '!') { dirpart[0] = *s; diff --git a/compose.c b/compose.c index a5178036..917b7fa6 100644 --- a/compose.c +++ b/compose.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2002,2007,2010,2012 Michael R. Elkins * Copyright (C) 2004 g10 Code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -288,13 +288,13 @@ static void redraw_mix_line (LIST *chain) mutt_window_clrtoeol (MuttIndexWindow); return; } - + for (c = 12; chain; chain = chain->next) { t = chain->data; if (t && t[0] == '0' && t[1] == '\0') t = ""; - + if (c + mutt_strlen (t) + 2 >= MuttIndexWindow->cols) break; @@ -324,13 +324,13 @@ check_attachments(ATTACH_CONTEXT *actx) pretty, i+1); return -1; } - + if(actx->idx[i]->content->stamp < st.st_mtime) { mutt_pretty_mailbox(pretty, sizeof (pretty)); snprintf(msg, sizeof(msg), _("%s [#%d] modified. Update encoding?"), pretty, i+1); - + if((r = mutt_yesorno(msg, MUTT_YES)) == MUTT_YES) mutt_update_encoding(actx->idx[i]->content); else if(r == -1) @@ -393,7 +393,7 @@ static void edit_address_list (int line, ADDRESS **addr) { char buf[HUGE_STRING] = ""; /* needs to be large for alias expansion */ char *err = NULL; - + mutt_addrlist_to_local (*addr); rfc822_write_address (buf, sizeof (buf), *addr, 0); if (mutt_get_field (_(Prompts[line]), buf, sizeof (buf), MUTT_ALIAS) == 0) @@ -516,13 +516,13 @@ static void update_idx (MUTTMENU *menu, ATTACH_CONTEXT *actx, ATTACHPTR *new) } -/* +/* * cum_attachs_size: Cumulative Attachments Size * * Returns the total number of bytes used by the attachments in the * attachment list _after_ content-transfer-encodings have been * applied. - * + * */ static unsigned long cum_attachs_size (MUTTMENU *menu) @@ -533,7 +533,7 @@ static unsigned long cum_attachs_size (MUTTMENU *menu) ATTACHPTR **idx = actx->idx; CONTENT *info; BODY *b; - + for (i = 0, s = 0; i < actx->idxlen; i++) { b = idx[i]->content; @@ -562,16 +562,16 @@ static unsigned long cum_attachs_size (MUTTMENU *menu) } /* prototype for use below */ -static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, +static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, const char *p); /* * compose_format_str() * - * %a = total number of attachments + * %a = total number of attachments * %h = hostname [option] - * %l = approx. length of current message (in bytes) - * %v = Mutt version + * %l = approx. length of current message (in bytes) + * %v = Mutt version * * This function is similar to status_format_str(). Look at that function for * help when modifying this function. @@ -631,7 +631,7 @@ compose_format_str (char *buf, size_t buflen, size_t col, int cols, char op, con static void compose_status_line (char *buf, size_t buflen, size_t col, int cols, MUTTMENU *menu, const char *p) { - mutt_FormatString (buf, buflen, col, cols, p, compose_format_str, + mutt_FormatString (buf, buflen, col, cols, p, compose_format_str, (unsigned long) menu, 0); } @@ -764,7 +764,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ crypt_opportunistic_encrypt (msg); redraw_crypt_lines (msg); } - mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); + mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); break; case OP_COMPOSE_EDIT_SUBJECT: if (msg->env->subject) @@ -995,7 +995,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ } menu->redraw |= REDRAW_FULL; - if (close == OP_QUIT) + if (close == OP_QUIT) mx_close_mailbox (Context, NULL); else mx_fastclose_mailbox (Context); @@ -1075,7 +1075,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ } mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); break; - + case OP_COMPOSE_TOGGLE_DISPOSITION: /* toggle the content-disposition between inline/attachment */ CURATTACH->content->disposition = (CURATTACH->content->disposition == DISPINLINE) ? DISPATTACH : DISPINLINE; @@ -1119,19 +1119,19 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ /* Note: We don't invoke send2-hook here, since we want to leave * users an opportunity to change settings from the ":" prompt. */ - + if(check_attachments(actx) != 0) { menu->redraw = REDRAW_FULL; break; } - + #ifdef MIXMASTER if (msg->chain && mix_check_message (msg) != 0) break; #endif - + if (!fccSet && *fcc) { if ((i = query_quadoption (OPT_COPY, @@ -1221,13 +1221,13 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ mutt_expand_path (fname, sizeof (fname)); if(mutt_rename_file (CURATTACH->content->filename, fname)) break; - + mutt_str_replace (&CURATTACH->content->filename, fname); menu->redraw = REDRAW_CURRENT; if(CURATTACH->content->stamp >= st.st_mtime) mutt_stamp_attachment(CURATTACH->content); - + } mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); break; @@ -1248,7 +1248,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ /* Call to lookup_mime_type () ? maybe later */ type[0] = 0; - if (mutt_get_field ("Content-Type: ", type, sizeof (type), 0) != 0 + if (mutt_get_field ("Content-Type: ", type, sizeof (type), 0) != 0 || !type[0]) continue; @@ -1293,7 +1293,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ menu->redraw = REDRAW_FULL; } } - mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); + mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); break; case OP_COMPOSE_EDIT_MIME: @@ -1369,7 +1369,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ menu->redraw = REDRAW_FULL; break; } - + loop = 0; r = 1; break; @@ -1486,7 +1486,7 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ #ifdef MIXMASTER case OP_COMPOSE_MIX: - + mix_make_chain (&msg->chain); mutt_message_hook (NULL, msg, MUTT_SEND2HOOK); break; @@ -1507,4 +1507,3 @@ int mutt_compose_menu (HEADER *msg, /* structure for new message */ return (r); } - diff --git a/compress.c b/compress.c index 9b809507..90ff4b4b 100644 --- a/compress.c +++ b/compress.c @@ -983,4 +983,3 @@ struct mx_ops mx_comp_ops = .msg_padding_size = compress_msg_padding_size, .save_to_header_cache = NULL, /* compressed doesn't support maildir/mh */ }; - diff --git a/copy.c b/copy.c index 64bdc73f..047fd433 100644 --- a/copy.c +++ b/copy.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002,2014 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -160,7 +160,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, /* Do we have anything pending? */ if (this_one) { - if (flags & CH_DECODE) + if (flags & CH_DECODE) { if (!address_header_decode (&this_one)) rfc2047_decode (&this_one); @@ -169,7 +169,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, if (!headers[x]) headers[x] = this_one; - else + else { int hlen = mutt_strlen (headers[x]); @@ -263,16 +263,16 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, /* Do we have anything pending? -- XXX, same code as in above in the loop. */ if (this_one) { - if (flags & CH_DECODE) + if (flags & CH_DECODE) { if (!address_header_decode (&this_one)) rfc2047_decode (&this_one); this_one_len = mutt_strlen (this_one); } - + if (!headers[x]) headers[x] = this_one; - else + else { int hlen = mutt_strlen (headers[x]); @@ -292,10 +292,10 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, /* We couldn't do the prefixing when reading because RFC 2047 * decoding may have concatenated lines. */ - + if (flags & (CH_DECODE|CH_PREFIX)) { - if (mutt_write_one_header (out, 0, headers[x], + if (mutt_write_one_header (out, 0, headers[x], flags & CH_PREFIX ? prefix : 0, mutt_window_wrap_cols (MuttIndexWindow, Wrap), flags) == -1) { @@ -304,7 +304,7 @@ mutt_copy_hdr (FILE *in, FILE *out, LOFF_T off_start, LOFF_T off_end, int flags, } } else - { + { if (fputs (headers[x], out) == EOF) { error = TRUE; @@ -474,7 +474,7 @@ mutt_copy_header (FILE *in, HEADER *h, FILE *out, int flags, const char *prefix) if (ferror (out) || feof (out)) return -1; - + return 0; } @@ -511,7 +511,7 @@ static int count_delete_lines (FILE *fp, BODY *b, LOFF_T *length, size_t datelen } /* make a copy of a message - * + * * fpout where to write output * fpin where to get input * hdr header of message being copied @@ -524,7 +524,7 @@ static int count_delete_lines (FILE *fp, BODY *b, LOFF_T *length, size_t datelen * MUTT_CM_PRINTING printing the message * MUTT_CM_UPDATE update structures in memory after syncing * MUTT_CM_DECODE_PGP used for decoding PGP messages - * MUTT_CM_CHARCONV perform character set conversion + * MUTT_CM_CHARCONV perform character set conversion * chflags flags to mutt_copy_header() */ @@ -597,7 +597,7 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, } #endif - /* Update original message if we are sync'ing a mailfolder */ + /* Update original message if we are sync'ing a mailfolder */ if (flags & MUTT_CM_UPDATE) { hdr->attach_del = 0; @@ -645,7 +645,7 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, s.flags |= MUTT_CHARCONV; if (flags & MUTT_CM_REPLYING) s.flags |= MUTT_REPLYING; - + if (WithCrypto && flags & MUTT_CM_VERIFY) s.flags |= MUTT_VERIFY; @@ -700,9 +700,9 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, { int c; size_t bytes = body->length; - + fputs(prefix, fpout); - + while((c = fgetc(fpin)) != EOF && bytes--) { fputc(c, fpout); @@ -710,13 +710,13 @@ _mutt_copy_message (FILE *fpout, FILE *fpin, HEADER *hdr, BODY *body, { fputs(prefix, fpout); } - } + } } else if (mutt_copy_bytes (fpin, fpout, body->length) == -1) return -1; } - if ((flags & MUTT_CM_UPDATE) && (flags & MUTT_CM_NOHEADER) == 0 + if ((flags & MUTT_CM_UPDATE) && (flags & MUTT_CM_NOHEADER) == 0 && new_offset != -1) { body->offset = new_offset; @@ -734,10 +734,10 @@ mutt_copy_message (FILE *fpout, CONTEXT *src, HEADER *hdr, int flags, { MESSAGE *msg; int r; - + if ((msg = mx_open_message (src, hdr->msgno)) == NULL) return -1; - if ((r = _mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0 + if ((r = _mutt_copy_message (fpout, msg->fp, hdr, hdr->content, flags, chflags)) == 0 && (ferror (fpout) || feof (fpout))) { dprint (1, (debugfile, "_mutt_copy_message failed to detect EOF!\n")); @@ -769,7 +769,7 @@ _mutt_append_message (CONTEXT *dest, FILE *fpin, CONTEXT *src, HEADER *hdr, fseeko (fpin, hdr->offset, 0); if (fgets (buf, sizeof (buf), fpin) == NULL) return -1; - + if ((msg = mx_open_new_message (dest, hdr, is_from (buf, NULL, 0, NULL) ? 0 : MUTT_ADD_FROM)) == NULL) return -1; if (dest->magic == MUTT_MBOX || dest->magic == MUTT_MMDF) @@ -847,13 +847,13 @@ static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout, char *date) return 0; } -/* +/* * This function is the equivalent of mutt_write_address_list(), * but writes to a buffer instead of writing to a stream. * mutt_write_address_list could be re-used if we wouldn't store - * all the decoded headers in a huge array, first. + * all the decoded headers in a huge array, first. * - * XXX - fix that. + * XXX - fix that. */ static void format_address_header (char **h, ADDRESS *a) @@ -876,8 +876,8 @@ static void format_address_header (char **h, ADDRESS *a) *buf = *cbuf = *c2buf = '\0'; l = rfc822_write_address (buf, sizeof (buf), a, 0); a->next = tmp; - - if (count && linelen + l > 74) + + if (count && linelen + l > 74) { strcpy (cbuf, "\n\t"); /* __STRCPY_CHECKED__ */ linelen = l + 8; @@ -910,7 +910,7 @@ static void format_address_header (char **h, ADDRESS *a) strcat (p + plen, c2buf); /* __STRCAT_CHECKED__ */ plen += c2buflen; } - + /* Space for this was allocated in the beginning of this function. */ strcat (p + plen, "\n"); /* __STRCAT_CHECKED__ */ } @@ -925,7 +925,7 @@ static int address_header_decode (char **h) switch (tolower ((unsigned char) *s)) { - case 'r': + case 'r': { if (ascii_strncasecmp (s, "return-path:", 12) == 0) { @@ -940,10 +940,10 @@ static int address_header_decode (char **h) } return 0; } - case 'f': + case 'f': { - if (ascii_strncasecmp (s, "from:", 5)) - return 0; + if (ascii_strncasecmp (s, "from:", 5)) + return 0; l = 5; break; } @@ -953,7 +953,7 @@ static int address_header_decode (char **h) return 0; l = 3; break; - + } case 'b': { @@ -983,12 +983,12 @@ static int address_header_decode (char **h) l = 17; break; } - default: return 0; + default: return 0; } if ((a = rfc822_parse_adrlist (a, s + l)) == NULL) return 0; - + mutt_addrlist_to_local (a); rfc2047_decode_adrlist (a); for (cur = a; cur; cur = cur->next) diff --git a/copy.h b/copy.h index 11ade381..402f3f4e 100644 --- a/copy.h +++ b/copy.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* flags to _mutt_copy_message */ #define MUTT_CM_NOHEADER 1 /* don't copy the message header */ diff --git a/crypt.c b/crypt.c index 0a7d6856..a0a490d5 100644 --- a/crypt.c +++ b/crypt.c @@ -1186,5 +1186,3 @@ short crypt_is_numerical_keyid (const char *s) return 1; } - - diff --git a/curs_lib.c b/curs_lib.c index 5472f45e..2435b8e0 100644 --- a/curs_lib.c +++ b/curs_lib.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2002,2010,2012-2013 Michael R. Elkins * Copyright (C) 2004 g10 Code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -213,7 +213,7 @@ int _mutt_get_field (const char *field, char *buf, size_t buflen, int complete, int x; ENTER_STATE *es = mutt_new_enter_state(); - + do { #if defined (USE_SLANG_CURSES) || defined (HAVE_RESIZETERM) @@ -261,7 +261,7 @@ void mutt_clear_error (void) void mutt_edit_file (const char *editor, const char *data) { char cmd[LONG_STRING]; - + mutt_endwin (NULL); mutt_expand_file_fmt (cmd, sizeof (cmd), editor, data); if (mutt_system (cmd)) @@ -296,7 +296,7 @@ int mutt_yesorno (const char *msg, int def) char answer[2]; answer[1] = 0; - + reyes_ok = (expr = nl_langinfo (YESEXPR)) && expr[0] == '^' && !REGCOMP (&reyes, expr, REG_NOSUB); reno_ok = (expr = nl_langinfo (NOEXPR)) && expr[0] == '^' && @@ -369,7 +369,7 @@ int mutt_yesorno (const char *msg, int def) #ifdef HAVE_LANGINFO_YESEXPR answer[0] = ch.ch; - if (reyes_ok ? + if (reyes_ok ? (regexec (& reyes, answer, 0, 0, 0) == 0) : #else if ( @@ -397,7 +397,7 @@ int mutt_yesorno (const char *msg, int def) FREE (&answer_string); -#ifdef HAVE_LANGINFO_YESEXPR +#ifdef HAVE_LANGINFO_YESEXPR if (reyes_ok) regfree (& reyes); if (reno_ok) @@ -857,7 +857,7 @@ void mutt_show_error (void) { if (option (OPTKEEPQUIET)) return; - + SETCOLOR (option (OPTMSGERR) ? MT_COLOR_ERROR : MT_COLOR_MESSAGE); mutt_window_mvaddstr (MuttMessageWindow, 0, 0, Errorbuf); NORMAL_COLOR; @@ -876,7 +876,7 @@ void mutt_endwin (const char *msg) mutt_refresh(); endwin (); } - + if (msg && *msg) { puts (msg); @@ -890,7 +890,7 @@ void mutt_perror (const char *s) { char *p = strerror (errno); - dprint (1, (debugfile, "%s: %s (errno = %d)\n", s, + dprint (1, (debugfile, "%s: %s (errno = %d)\n", s, p ? p : "unknown error", errno)); mutt_error ("%s: %s (errno = %d)", s, p ? p : _("unknown error"), errno); } @@ -929,13 +929,13 @@ int mutt_do_pager (const char *banner, pager_t *info) { int rc; - + if (!Pager || mutt_strcmp (Pager, "builtin") == 0) rc = mutt_pager (banner, tempfile, do_color, info); else { char cmd[STRING]; - + mutt_endwin (NULL); mutt_expand_file_fmt (cmd, sizeof(cmd), Pager, tempfile); if (mutt_system (cmd) == -1) @@ -977,7 +977,7 @@ int _mutt_enter_fname (const char *prompt, char *buf, size_t blen, int buffy, in { mutt_refresh (); buf[0] = 0; - _mutt_select_file (buf, blen, MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI : 0), + _mutt_select_file (buf, blen, MUTT_SEL_FOLDER | (multiple ? MUTT_SEL_MULTI : 0), files, numfiles); } else @@ -1073,12 +1073,12 @@ void mutt_flushinp (void) void mutt_curs_set (int cursor) { static int SavedCursor = 1; - + if (cursor < 0) cursor = SavedCursor; else SavedCursor = cursor; - + if (curs_set (cursor) == ERR) { if (cursor == 1) /* cnorm */ curs_set (2); /* cvvis */ diff --git a/date.c b/date.c index 497ffdd4..4080b647 100644 --- a/date.c +++ b/date.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -203,7 +203,7 @@ void mutt_normalize_time (struct tm *tm) } tm->tm_mday += DaysPerMonth[tm->tm_mon] + isLeapYearFeb (tm); } - while (tm->tm_mday > (DaysPerMonth[tm->tm_mon] + + while (tm->tm_mday > (DaysPerMonth[tm->tm_mon] + (nLeap = isLeapYearFeb (tm)))) { tm->tm_mday -= DaysPerMonth[tm->tm_mon] + nLeap; diff --git a/doc/makedoc.c b/doc/makedoc.c index 29f9dcae..b45502ed 100644 --- a/doc/makedoc.c +++ b/doc/makedoc.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2000 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /** ** This program parses mutt's init.h and generates documentation in @@ -22,7 +22,7 @@ ** ** -> a commented muttrc configuration file ** -> nroff, suitable for inclusion in a manual page - ** -> docbook-xml, suitable for inclusion in the + ** -> docbook-xml, suitable for inclusion in the ** SGML-based manual ** **/ @@ -130,7 +130,7 @@ int main (int argc, char *argv[]) Progname++; else Progname = argv[0]; - + while ((c = getopt (argc, argv, "cmsd")) != EOF) { switch (c) @@ -139,7 +139,7 @@ int main (int argc, char *argv[]) case 'm': OutputFormat = F_MAN; break; case 's': OutputFormat = F_SGML; break; case 'd': Debug++; break; - default: + default: { fprintf (stderr, "%s: bad command line parameter.\n", Progname); exit (1); @@ -156,13 +156,13 @@ int main (int argc, char *argv[]) exit (1); } } - else + else f = stdin; switch (OutputFormat) { - case F_CONF: - case F_MAN: + case F_CONF: + case F_MAN: case F_SGML: makedoc (f, stdout); break; default: { @@ -171,7 +171,7 @@ int main (int argc, char *argv[]) exit (1); } } - + if (f != stdin) fclose (f); @@ -208,7 +208,7 @@ static void makedoc (FILE *in, FILE *out) fprintf (stderr, "%s: line %d. first token: \"%s\".\n", Progname, line, token); } - + if (!strcmp (token, "/*++*/")) active = 1; else if (!strcmp (token, "/*--*/")) @@ -251,7 +251,7 @@ static char *get_token (char *d, size_t l, char *s) if (Debug) fprintf (stderr, "%s: get_token called for `%s'.\n", Progname, s); - + s = skip_ws (s); if (Debug > 1) @@ -283,7 +283,7 @@ static char *get_token (char *d, size_t l, char *s) { fprintf (stderr, "%s: found quote character.\n", Progname); } - + s++; is_quoted = 1; } @@ -329,14 +329,14 @@ static char *get_token (char *d, size_t l, char *s) fprintf (stderr, "%s: Remainder: `%s'.\n", Progname, t); } - + return t; } /** ** Configuration line parser - ** + ** ** The following code parses a line from init.h which declares ** a configuration variable. ** @@ -346,7 +346,7 @@ static char *get_token (char *d, size_t l, char *s) * following string definitions! */ -enum +enum { DT_NONE = 0, DT_BOOL, @@ -363,12 +363,12 @@ enum DT_MBCHARTBL }; -struct +struct { char *machine; char *human; } -types[] = +types[] = { { "DT_NONE", "-none-" }, { "DT_BOOL", "boolean" }, @@ -385,12 +385,12 @@ types[] = { "DT_MBCHARTBL", "string" }, { NULL, NULL } }; - + static int buff2type (const char *s) { int type; - + for (type = DT_NONE; types[type].machine; type++) if (!strcmp (types[type].machine, s)) return type; @@ -410,17 +410,17 @@ static void handle_confline (char *s, FILE *out) char buff[BUFFSIZE]; char tmp[BUFFSIZE]; int type; - + char val[BUFFSIZE]; /* xxx - put this into an actual state machine? */ /* variable name */ if (!(s = get_token (varname, sizeof (varname), s))) return; - + /* comma */ if (!(s = get_token (buff, sizeof (buff), s))) return; - + /* type */ if (!(s = get_token (buff, sizeof (buff), s))) return; @@ -438,7 +438,7 @@ static void handle_confline (char *s, FILE *out) } /* redraw, comma */ - + while (1) { if (!(s = get_token (buff, sizeof (buff), s))) return; @@ -455,7 +455,7 @@ static void handle_confline (char *s, FILE *out) if (!(s = get_token (buff, sizeof (buff), s))) return; if (Debug) fprintf (stderr, "%s: Expecting default value.\n", Progname); - + /* or UL */ if (!(s = get_token (buff, sizeof (buff), s))) return; if (!strcmp (buff, "UL")) @@ -466,7 +466,7 @@ static void handle_confline (char *s, FILE *out) memset (tmp, 0, sizeof (tmp)); - do + do { if (!strcmp (buff, "}")) break; @@ -487,7 +487,7 @@ static void pretty_default (char *t, size_t l, const char *s, int type) switch (type) { case DT_QUAD: - { + { if (!strcasecmp (s, "MUTT_YES")) strncpy (t, "yes", l); else if (!strcasecmp (s, "MUTT_NO")) strncpy (t, "no", l); else if (!strcasecmp (s, "MUTT_ASKYES")) strncpy (t, "ask-yes", l); @@ -584,7 +584,7 @@ static void man_print_strval (const char *v, FILE *out) conf_char_to_escape ((unsigned int) *v, out); continue; } - + if (*v == '"') fputs ("\\(rq", out); else if (*v == '\\') @@ -659,7 +659,7 @@ static int sgml_id_fputs (const char *s, FILE* out) static void print_confline (const char *varname, int type, const char *val, FILE *out) { if (type == DT_SYN) return; - + switch (OutputFormat) { /* configuration file */ @@ -674,7 +674,7 @@ static void print_confline (const char *varname, int type, const char *val, FILE } else if (type != DT_SYN) fprintf (out, "\n# set %s=%s", varname, val); - + fprintf (out, "\n#\n# Name: %s", varname); fprintf (out, "\n# Type: %s", type2human (type)); if (type == DT_STR || type == DT_RX || type == DT_ADDR || type == DT_PATH || @@ -714,7 +714,7 @@ static void print_confline (const char *varname, int type, const char *val, FILE break; } - + /* SGML based manual */ case F_SGML: { @@ -724,7 +724,7 @@ static void print_confline (const char *varname, int type, const char *val, FILE sgml_fputs (varname, out); fprintf (out, "\nType: %s", type2human (type)); - + if (type == DT_STR || type == DT_RX || type == DT_ADDR || type == DT_PATH || type == DT_MBCHARTBL) { @@ -753,11 +753,11 @@ static void print_confline (const char *varname, int type, const char *val, FILE /** ** Documentation line parser ** - ** The following code parses specially formatted documentation + ** The following code parses specially formatted documentation ** comments in init.h. ** ** The format is very remotely inspired by nroff. Most important, it's - ** easy to parse and convert, and it was easy to generate from the SGML + ** easy to parse and convert, and it was easy to generate from the SGML ** source of mutt's original manual. ** ** - \fI switches to italics @@ -819,7 +819,7 @@ static int flush_doc (int docstat, FILE *out) static int print_it (int special, char *str, FILE *out, int docstat) { int onl = docstat & (D_NL|D_NP); - + docstat &= ~(D_NL|D_NP|D_INIT); switch (OutputFormat) @@ -835,7 +835,7 @@ static int print_it (int special, char *str, FILE *out, int docstat) case SP_START_BF: docstat |= D_BF; break; case SP_START_EM: docstat |= D_EM; break; case SP_START_TT: docstat |= D_TT; break; - case SP_NEWLINE: + case SP_NEWLINE: { if (onl) docstat |= onl; @@ -862,9 +862,9 @@ static int print_it (int special, char *str, FILE *out, int docstat) docstat |= D_NP; break; } - case SP_START_TAB: + case SP_START_TAB: { - if (!onl) + if (!onl) fputs ("\n# ", out); docstat |= D_TAB; break; @@ -919,7 +919,7 @@ static int print_it (int special, char *str, FILE *out, int docstat) } fputs (str, out); if (docstat & D_DT) - { + { int i; for (i = strlen (str) ; i < 8 ; i++) @@ -938,13 +938,13 @@ static int print_it (int special, char *str, FILE *out, int docstat) { switch (special) { - case SP_END_FT: + case SP_END_FT: { fputs ("\\fP", out); docstat &= ~(D_EM|D_BF|D_TT); break; } - case SP_START_BF: + case SP_START_BF: { fputs ("\\fB", out); docstat |= D_BF; @@ -1078,7 +1078,7 @@ static int print_it (int special, char *str, FILE *out, int docstat) { switch (special) { - case SP_END_FT: + case SP_END_FT: { if (docstat & D_EM) fputs ("", out); if (docstat & D_BF) fputs ("", out); @@ -1086,7 +1086,7 @@ static int print_it (int special, char *str, FILE *out, int docstat) docstat &= ~(D_EM|D_BF|D_TT); break; } - case SP_START_BF: + case SP_START_BF: { fputs ("", out); docstat |= D_BF; @@ -1307,7 +1307,7 @@ static int handle_docline (char *l, FILE *out, int docstat) if (Debug) fprintf (stderr, "%s: handle_docline `%s'\n", Progname, l); - + if (!strncmp (l, ".pp", 3)) return print_it (SP_NEWPAR, NULL, out, docstat); else if (!strncmp (l, ".ts", 3)) diff --git a/dotlock.c b/dotlock.c index 5bf03480..584c8a16 100644 --- a/dotlock.c +++ b/dotlock.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 1998-2001,2007 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * This module either be compiled into Mutt, or it can be @@ -141,13 +141,13 @@ int main (int argc, char **argv) struct utsname utsname; /* first, drop privileges */ - + if (dotlock_init_privs () == -1) return DL_EX_ERROR; /* determine the system's host name */ - + uname (&utsname); if (!(Hostname = strdup (utsname.nodename))) /* __MEM_CHECKED__ */ return DL_EX_ERROR; @@ -157,7 +157,7 @@ int main (int argc, char **argv) /* parse the command line options. */ DotlockFlags = 0; - + while ((i = getopt (argc, argv, "dtfupr:")) != EOF) { switch (i) @@ -171,7 +171,7 @@ int main (int argc, char **argv) case 'f': DotlockFlags |= DL_FL_FORCE; break; case 'p': DotlockFlags |= DL_FL_USEPRIV; break; case 'r': DotlockFlags |= DL_FL_RETRY; Retry = atoi (optarg); break; - + default: usage (argv[0]); } } @@ -183,15 +183,15 @@ int main (int argc, char **argv) } -/* - * Determine our effective group ID, and drop +/* + * Determine our effective group ID, and drop * privileges. - * + * * Return value: - * + * * 0 - everything went fine * -1 - we couldn't drop privileges. - * + * */ @@ -200,7 +200,7 @@ dotlock_init_privs (void) { # ifdef USE_SETGID - + UserGid = getgid (); MailGid = getegid (); @@ -211,11 +211,11 @@ dotlock_init_privs (void) return 0; } - + #else /* DL_STANDALONE */ -/* +/* * This function is intended to be invoked from within * mutt instead of mx.c's invoke_dotlock (). */ @@ -226,7 +226,7 @@ int dotlock_invoke (const char *path, int fd, int flags, int retry) int r; DotlockFlags = flags; - + if ((currdir = open (".", O_RDONLY)) == -1) return DL_EX_ERROR; @@ -234,12 +234,12 @@ int dotlock_invoke (const char *path, int fd, int flags, int retry) Retry = MAXLOCKATTEMPT; else Retry = 0; - + r = dotlock_dispatch (path, fd); - + fchdir (currdir); close (currdir); - + return r; } @@ -256,7 +256,7 @@ static int dotlock_dispatch (const char *f, int fd) * `dirname $f`. Additionally, f has been opened for * reading to verify that the user has at least read * permissions on that file. - * + * * For a more detailed explanation of all this, see the * lengthy comment below. */ @@ -276,16 +276,16 @@ static int dotlock_dispatch (const char *f, int fd) return dotlock_lock (realpath); } - + /* - * Get privileges - * + * Get privileges + * * This function re-acquires the privileges we may have * if the user told us to do so by giving the "-p" * command line option. - * + * * BEGIN_PRIVILEGES () won't return if an error occurs. - * + * */ static void @@ -305,9 +305,9 @@ BEGIN_PRIVILEGED (void) /* * Drop privileges - * + * * This function drops the group privileges we may have. - * + * * END_PRIVILEGED () won't return if an error occurs. * */ @@ -331,12 +331,12 @@ END_PRIVILEGED (void) /* * Usage information. - * + * * This function doesn't return. - * + * */ -static void +static void usage (const char *av0) { fprintf (stderr, "dotlock [Mutt %s (%s)]\n", MUTT_VERSION, ReleaseDate); @@ -354,7 +354,7 @@ usage (const char *av0) #endif "\n -r \tRetry locking" "\n", stderr); - + exit (DL_EX_ERROR); } @@ -363,48 +363,48 @@ usage (const char *av0) /* * Access checking: Let's avoid to lock other users' mail * spool files if we aren't permitted to read them. - * + * * Some simple-minded access (2) checking isn't sufficient * here: The problem is that the user may give us a * deeply nested path to a file which has the same name * as the file he wants to lock, but different * permissions, say, e.g. * /tmp/lots/of/subdirs/var/spool/mail/root. - * + * * He may then try to replace /tmp/lots/of/subdirs by a * symbolic link to / after we have invoked access () to * check the file's permissions. The lockfile we'd * create or remove would then actually be * /var/spool/mail/root. - * + * * To avoid this attack, we proceed as follows: - * + * * - First, follow symbolic links a la * dotlock_deference_symlink (). - * + * * - get the result's dirname. - * + * * - chdir to this directory. If you can't, bail out. - * + * * - try to open the file in question, only using its * basename. If you can't, bail out. - * + * * - fstat that file and compare the result to a * subsequent lstat (only using the basename). If * the comparison fails, bail out. - * + * * dotlock_prepare () is invoked from main () directly * after the command line parsing has been done. * * Return values: - * + * * 0 - Evereything's fine. The program's new current * directory is the contains the file to be locked. * The string pointed to by bn contains the name of * the file to be locked. - * + * * -1 - Something failed. Don't continue. - * + * * tlr, Jul 15 1998 */ @@ -418,7 +418,7 @@ dotlock_check_stats (struct stat *fsb, struct stat *lsb) if (S_ISLNK (lsb->st_mode) || S_ISLNK (fsb->st_mode)) return -1; - + if ((lsb->st_dev != fsb->st_dev) || (lsb->st_ino != fsb->st_ino) || (lsb->st_mode != fsb->st_mode) || @@ -431,7 +431,7 @@ dotlock_check_stats (struct stat *fsb, struct stat *lsb) /* something's fishy */ return -1; } - + return 0; } @@ -444,10 +444,10 @@ dotlock_prepare (char *bn, size_t l, const char *f, int _fd) char *p; int fd; int r; - + if (dotlock_deference_symlink (realpath, sizeof (realpath), f) == -1) return -1; - + if ((p = strrchr (realpath, '/'))) { *p = '\0'; @@ -462,9 +462,9 @@ dotlock_prepare (char *bn, size_t l, const char *f, int _fd) if (strlen (basename) + 1 > l) return -1; - + strfcpy (bn, basename, l); - + if (chdir (dirname) == -1) return -1; @@ -472,15 +472,15 @@ dotlock_prepare (char *bn, size_t l, const char *f, int _fd) fd = _fd; else if ((fd = open (basename, O_RDONLY)) == -1) return -1; - + r = fstat (fd, &fsb); - + if (_fd == -1) close (fd); - + if (r == -1) return -1; - + if (lstat (basename, &lsb) == -1) return -1; @@ -492,13 +492,13 @@ dotlock_prepare (char *bn, size_t l, const char *f, int _fd) /* * Expand a symbolic link. - * + * * This function expects newpath to have space for * at least _POSIX_PATH_MAX characters. * */ -static void +static void dotlock_expand_link (char *newpath, const char *path, const char *link) { const char *lb = NULL; @@ -526,7 +526,7 @@ dotlock_expand_link (char *newpath, const char *path, const char *link) /* * Deference a chain of symbolic links - * + * * The final path is written to d. * */ @@ -538,7 +538,7 @@ dotlock_deference_symlink (char *d, size_t l, const char *path) char realpath[_POSIX_PATH_MAX]; const char *pathptr = path; int count = 0; - + while (count++ < MAXLINKS) { if (lstat (pathptr, &sb) == -1) @@ -546,7 +546,7 @@ dotlock_deference_symlink (char *d, size_t l, const char *path) /* perror (pathptr); */ return -1; } - + if (S_ISLNK (sb.st_mode)) { char linkfile[_POSIX_PATH_MAX]; @@ -558,7 +558,7 @@ dotlock_deference_symlink (char *d, size_t l, const char *path) /* perror (pathptr); */ return -1; } - + linkfile[len] = '\0'; dotlock_expand_link (linkpath, pathptr, linkfile); strfcpy (realpath, linkpath, sizeof (realpath)); @@ -574,11 +574,11 @@ dotlock_deference_symlink (char *d, size_t l, const char *path) /* * Dotlock a file. - * + * * realpath is assumed _not_ to be an absolute path to * the file we are about to lock. Invoke * dotlock_prepare () before using this function! - * + * */ #define HARDMAXATTEMPTS 10 @@ -594,12 +594,12 @@ dotlock_lock (const char *realpath) int hard_count = 0; struct stat sb; time_t t; - + snprintf (nfslockfile, sizeof (nfslockfile), "%s.%s.%d", realpath, Hostname, (int) getpid ()); snprintf (lockfile, sizeof (lockfile), "%s.lock", realpath); - + BEGIN_PRIVILEGED (); unlink (nfslockfile); @@ -608,22 +608,22 @@ dotlock_lock (const char *realpath) { END_PRIVILEGED (); - + if (errno != EAGAIN) { /* perror ("cannot open NFS lock file"); */ return DL_EX_ERROR; } - + BEGIN_PRIVILEGED (); } END_PRIVILEGED (); - + close (fd); - + while (hard_count++ < HARDMAXATTEMPTS) { @@ -662,13 +662,13 @@ dotlock_lock (const char *realpath) return DL_EX_EXIST; } } - + prev_size = sb.st_size; - + /* don't trust sleep (3) as it may be interrupted - * by users sending signals. + * by users sending signals. */ - + t = time (NULL); do { sleep (1); @@ -684,10 +684,10 @@ dotlock_lock (const char *realpath) /* - * Unlock a file. - * + * Unlock a file. + * * The same comment as for dotlock_lock () applies here. - * + * */ static int @@ -698,14 +698,14 @@ dotlock_unlock (const char *realpath) snprintf (lockfile, sizeof (lockfile), "%s.lock", realpath); - + BEGIN_PRIVILEGED (); i = unlink (lockfile); END_PRIVILEGED (); - + if (i == -1) return DL_EX_ERROR; - + return DL_EX_OK; } @@ -731,9 +731,9 @@ dotlock_unlink (const char *realpath) /* * Check if a file can be locked at all. - * + * * The same comment as for dotlock_lock () applies here. - * + * */ static int diff --git a/dotlock.h b/dotlock.h index 240da630..9c89a4e1 100644 --- a/dotlock.h +++ b/dotlock.h @@ -1,30 +1,30 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 1998-2000 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _DOTLOCK_H #define _DOTLOCK_H /* exit values */ -#define DL_EX_OK 0 -#define DL_EX_ERROR 1 -#define DL_EX_EXIST 3 +#define DL_EX_OK 0 +#define DL_EX_ERROR 1 +#define DL_EX_EXIST 3 #define DL_EX_NEED_PRIVS 4 #define DL_EX_IMPOSSIBLE 5 diff --git a/edit.c b/edit.c index b0e7cc7b..772bccea 100644 --- a/edit.c +++ b/edit.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* Close approximation of the mailx(1) builtin editor for sending mail. */ @@ -100,7 +100,7 @@ be_snarf_file (const char *path, char **buf, int *max, int *len, int verbose) FILE *f; char tmp[LONG_STRING]; struct stat sb; - + if ((f = fopen (path, "r"))) { fstat (fileno (f), &sb); @@ -124,7 +124,7 @@ static int be_barf_file (const char *path, char **buf, int buflen) { FILE *f; int i; - + if ((f = fopen (path, "w")) == NULL) /* __FOPEN_CHECKED__ */ { addstr (strerror (errno)); @@ -324,7 +324,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur) int done = 0; int i; char *p; - + scrollok (stdscr, TRUE); be_edit_header (msg->env, 0); @@ -482,7 +482,7 @@ int mutt_builtin_editor (const char *path, HEADER *msg, HEADER *cur) safe_realloc (&buf, sizeof (char *) * (bufmax += 25)); buf[buflen++] = safe_strdup (tmp[1] == '~' ? tmp + 1 : tmp); } - + tmp[0] = 0; } diff --git a/editmsg.c b/editmsg.c index 356810a0..2db86835 100644 --- a/editmsg.c +++ b/editmsg.c @@ -1,23 +1,23 @@ /* * Copyright (C) 1999-2002 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ /* simple, editor-based message editing */ @@ -37,7 +37,7 @@ /* * return value: - * + * * 1 message not modified * 0 message edited successfully * -1 error @@ -55,7 +55,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) unsigned short o_old; int of, cf; - + CONTEXT tmpctx; MESSAGE *msg; @@ -63,7 +63,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) struct stat sb; time_t mtime = 0; - + mutt_mktemp (tmp, sizeof (tmp)); omagic = DefaultMagic; @@ -121,7 +121,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) mutt_error (_("Can't stat %s: %s"), tmp, strerror (errno)); goto bail; } - + if (sb.st_size == 0) { mutt_message (_("Message file is empty!")); @@ -153,7 +153,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) of = 0; cf = ((tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF) ? 0 : CH_NOSTATUS); - + if (fgets (buff, sizeof (buff), fp) && is_from (buff, NULL, 0, NULL)) { if (tmpctx.magic == MUTT_MBOX || tmpctx.magic == MUTT_MMDF) @@ -162,7 +162,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) else of = MUTT_ADD_FROM; - /* + /* * XXX - we have to play games with the message flags to avoid * problematic behavior with maildir folders. * @@ -188,9 +188,9 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) rc = mx_commit_message (msg, &tmpctx); mx_close_message (&tmpctx, &msg); - + mx_close_mailbox (&tmpctx, NULL); - + bail: if (fp) safe_fclose (&fp); @@ -209,7 +209,7 @@ static int edit_one_message (CONTEXT *ctx, HEADER *cur) else if (rc == -1) mutt_message (_("Error. Preserving temporary file: %s"), tmp); - + return rc; } @@ -220,7 +220,7 @@ int mutt_edit_message (CONTEXT *ctx, HEADER *hdr) if (hdr) return edit_one_message (ctx, hdr); - + for (i = 0; i < ctx->vcount; i++) { j = ctx->v2r[i]; diff --git a/enter.c b/enter.c index c134091a..83b47b4a 100644 --- a/enter.c +++ b/enter.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2007,2011,2013 Michael R. Elkins * Copyright (C) 2000-2001 Edmund Grimley Evans - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -78,7 +78,7 @@ static size_t width_ceiling (const wchar_t *s, size_t n, int w1) for (; n; s++, n--) if ((w += my_wcwidth (*s)) > w1) break; - return s - s0; + return s - s0; } static void my_wcstombs (char *dest, size_t dlen, const wchar_t *src, size_t slen) @@ -129,7 +129,7 @@ static size_t my_mbstowcs (wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *bu size_t wbuflen; wbuf = *pwbuf, wbuflen = *pwbuflen; - + while (*buf) { memset (&st, 0, sizeof (st)); @@ -145,7 +145,7 @@ static size_t my_mbstowcs (wchar_t **pwbuf, size_t *pwbuflen, size_t i, char *bu } if (*buf && (k == (size_t) -1 || k == (size_t) -2)) { - if (i >= wbuflen) + if (i >= wbuflen) { wbuflen = i + 20; safe_realloc (&wbuf, wbuflen * sizeof (*wbuf)); @@ -257,7 +257,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, int rv = 0; memset (&mbstate, 0, sizeof (mbstate)); - + if (state->wbuf) { /* Coming back after return 1 */ @@ -284,9 +284,9 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, hclass = HC_COMMAND; else if (flags & MUTT_PATTERN) hclass = HC_PATTERN; - else + else hclass = HC_OTHER; - + for (;;) { if (redraw && !pass) @@ -296,7 +296,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, /* Go to end of line */ state->curpos = state->lastchar; state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->lastchar) - width + 1); - } + } if (state->curpos < state->begin || my_wcswidth (state->wbuf + state->begin, state->curpos - state->begin) >= width) state->begin = width_ceiling (state->wbuf, state->lastchar, my_wcswidth (state->wbuf, state->curpos) - width / 2); @@ -563,7 +563,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, mutt_select_file (buf, buflen, (flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0); if (*buf) replace_part (state, i, buf); - rv = 1; + rv = 1; goto bye; } if (!mutt_complete (buf, buflen)) @@ -579,7 +579,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, else if (flags & MUTT_ALIAS && ch == OP_EDITOR_COMPLETE) { /* invoke the alias-menu to get more addresses */ - for (i = state->curpos; i && state->wbuf[i-1] != ',' && + for (i = state->curpos; i && state->wbuf[i-1] != ',' && state->wbuf[i-1] != ':'; i--) ; for (; i < state->lastchar && state->wbuf[i] == ' '; i++) @@ -596,7 +596,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, } else if (flags & MUTT_LABEL && ch == OP_EDITOR_COMPLETE) { - for (i = state->curpos; i && state->wbuf[i-1] != ',' && + for (i = state->curpos; i && state->wbuf[i-1] != ',' && state->wbuf[i-1] != ':'; i--) ; for (; i < state->lastchar && state->wbuf[i] == ' '; i++) @@ -646,7 +646,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, mutt_query_complete (buf, buflen); replace_part (state, i, buf); - rv = 1; + rv = 1; goto bye; } else if (flags & MUTT_COMMAND) @@ -668,8 +668,8 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, if ((!tempbuf && !state->lastchar) || (tempbuf && templen == state->lastchar && !memcmp (tempbuf, state->wbuf, state->lastchar * sizeof (wchar_t)))) { - _mutt_select_file (buf, buflen, - ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | (multiple ? MUTT_SEL_MULTI : 0), + _mutt_select_file (buf, buflen, + ((flags & MUTT_EFILE) ? MUTT_SEL_FOLDER : 0) | (multiple ? MUTT_SEL_MULTI : 0), files, numfiles); if (*buf) { @@ -738,7 +738,7 @@ int _mutt_enter_string (char *buf, size_t buflen, int col, } else { - + self_insert: state->tabs = 0; @@ -794,7 +794,7 @@ self_insert: tfiles[0] = safe_strdup (buf); *files = tfiles; } - rv = 0; + rv = 0; goto bye; } else if (wc && (wc < ' ' || IsWPrint (wc))) /* why? */ @@ -815,7 +815,7 @@ self_insert: } } } - + bye: mutt_reset_history_state (hclass); @@ -826,7 +826,7 @@ self_insert: void mutt_free_enter_state (ENTER_STATE **esp) { if (!esp) return; - + FREE (&(*esp)->wbuf); FREE (esp); /* __FREE_CHECKED__ */ } diff --git a/extlib.c b/extlib.c index a8f467db..d1f7e418 100644 --- a/extlib.c +++ b/extlib.c @@ -1,25 +1,25 @@ /* * Copyright (C) 1999-2000 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ -/* +/* * Some simple dummies, so we can reuse the routines from * lib.c in external programs. */ @@ -40,4 +40,3 @@ void mutt_exit (int code) { exit (code); } - diff --git a/filter.c b/filter.c index 59d1e09c..a49eb271 100644 --- a/filter.c +++ b/filter.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins. - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -140,7 +140,7 @@ mutt_create_filter_fd (const char *cmd, FILE **in, FILE **out, FILE **err, close (pin[0]); close (pin[1]); } - + if (out) { close (pout[0]); @@ -185,11 +185,11 @@ pid_t mutt_create_filter (const char *s, FILE **in, FILE **out, FILE **err) int mutt_wait_filter (pid_t pid) { int rc; - + waitpid (pid, &rc, 0); mutt_unblock_signals_system (1); rc = WIFEXITED (rc) ? WEXITSTATUS (rc) : -1; - + return rc; } diff --git a/flags.c b/flags.c index 51fabcbf..88cd03fc 100644 --- a/flags.c +++ b/flags.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -70,19 +70,19 @@ void _mutt_set_flag (CONTEXT *ctx, HEADER *h, int flag, int bf, int upd_ctx) if (upd_ctx) ctx->deleted--; #ifdef USE_IMAP /* see my comment above */ - if (ctx->magic == MUTT_IMAP) + if (ctx->magic == MUTT_IMAP) { h->changed = 1; if (upd_ctx) ctx->changed = 1; } #endif - /* + /* * If the user undeletes a message which is marked as * "trash" in the maildir folder on disk, the folder has * been changed, and is marked accordingly. However, we do * _not_ mark the message itself changed, because trashing * is checked in specific code in the maildir folder - * driver. + * driver. */ if (ctx->magic == MUTT_MAILDIR && upd_ctx && h->trash) ctx->changed = 1; @@ -297,7 +297,7 @@ void mutt_tag_set_flag (int flag, int bf) int mutt_thread_set_flag (HEADER *hdr, int flag, int bf, int subthread) { THREAD *start, *cur = hdr->thread; - + if ((Sort & SORT_MASK) != SORT_THREADS) { mutt_error _("Threading is not enabled."); @@ -308,7 +308,7 @@ int mutt_thread_set_flag (HEADER *hdr, int flag, int bf, int subthread) while (cur->parent) cur = cur->parent; start = cur; - + if (cur->message) mutt_set_flag (Context, cur->message, flag, bf); @@ -324,7 +324,7 @@ int mutt_thread_set_flag (HEADER *hdr, int flag, int bf, int subthread) cur = cur->child; else if (cur->next) cur = cur->next; - else + else { while (!cur->next) { diff --git a/from.c b/from.c index 004bab58..bcba4823 100644 --- a/from.c +++ b/from.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -88,7 +88,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t *tp) { if (*p == '\\') { - if (*++p == '\0') + if (*++p == '\0') return 0; } else if (*p == '"') @@ -109,7 +109,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t *tp) return 0; } } - + if (path) { len = (size_t) (p - s); @@ -119,7 +119,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t *tp) path[len] = 0; dprint (3, (debugfile, "is_from(): got return path: %s\n", path)); } - + s = p + 1; SKIPWS (s); if (!*s) @@ -187,7 +187,7 @@ int is_from (const char *s, char *path, size_t pathlen, time_t *tp) /* year */ if (sscanf (s, "%d", &yr) != 1 || yr < 0) return 0; tm.tm_year = yr > 1900 ? yr - 1900 : (yr < 70 ? yr + 100 : yr); - + dprint (3,(debugfile, "is_from(): month=%d, day=%d, hr=%d, min=%d, sec=%d, yr=%d.\n", tm.tm_mon, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec, tm.tm_year)); diff --git a/functions.h b/functions.h index 3ce925f8..33f3a07b 100644 --- a/functions.h +++ b/functions.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * This file contains the structures needed to parse ``bind'' commands, as @@ -253,7 +253,7 @@ const struct binding_t OpPager[] = { /* map: pager */ { "search-toggle", OP_SEARCH_TOGGLE, "\\" }, { "display-address", OP_DISPLAY_ADDRESS, "@" }, { "next-new", OP_MAIN_NEXT_NEW, NULL }, - { "next-new-then-unread", + { "next-new-then-unread", OP_MAIN_NEXT_NEW_THEN_UNREAD, "\t" }, { "pipe-message", OP_PIPE, "|" }, { "help", OP_HELP, "?" }, @@ -383,7 +383,7 @@ const struct binding_t OpCompose[] = { /* map: compose */ #ifdef MIXMASTER { "mix", OP_COMPOSE_MIX, "M" }, #endif - + { NULL, 0, NULL } }; @@ -398,7 +398,7 @@ const struct binding_t OpAlias[] = { /* map: alias */ { "undelete-entry", OP_UNDELETE, "u" }, { NULL, 0, NULL } }; - + /* The file browser */ const struct binding_t OpBrowser[] = { /* map: browser */ diff --git a/getdomain.c b/getdomain.c index 2190d76e..b3c483f2 100644 --- a/getdomain.c +++ b/getdomain.c @@ -70,4 +70,3 @@ int getdnsdomainname (char *d, size_t len) return ret; } - diff --git a/globals.h b/globals.h index b74b4d1c..facb2ea8 100644 --- a/globals.h +++ b/globals.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2010,2016 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ WHERE void (*mutt_error) (const char *, ...); WHERE void (*mutt_message) (const char *, ...); @@ -312,7 +312,7 @@ extern const char * const Months[]; #endif #ifdef MAIN_C -/* so that global vars get included */ +/* so that global vars get included */ #include "mx.h" #include "mutt_regex.h" #include "buffy.h" diff --git a/gnupgparse.c b/gnupgparse.c index 9a2e0cb7..2218ed53 100644 --- a/gnupgparse.c +++ b/gnupgparse.c @@ -22,12 +22,12 @@ /* * NOTE - * + * * This code used to be the parser for GnuPG's output. - * - * Nowadays, we are using an external pubring lister with PGP which mimics + * + * Nowadays, we are using an external pubring lister with PGP which mimics * gpg's output format. - * + * */ #if HAVE_CONFIG_H @@ -338,7 +338,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) break; case 12: /* key capabilities */ dprint (2, (debugfile, "capabilities info: %s\n", p)); - + while(*p) { switch(*p++) @@ -357,7 +357,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) } } - if (!is_uid && + if (!is_uid && (!*is_subkey || !option (OPTPGPIGNORESUB) || !((flags & KEYFLAG_DISABLED) || (flags & KEYFLAG_REVOKED) @@ -365,7 +365,7 @@ static pgp_key_t parse_pub_line (char *buf, int *is_subkey, pgp_key_t k) tmp.flags |= flags; break; - + default: break; } @@ -403,7 +403,7 @@ pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints) return NULL; mutt_str_replace (&_chs, Charset); - + thepid = pgp_invoke_list_keys (NULL, &fp, NULL, -1, -1, devnull, keyring, hints); if (thepid == -1) @@ -429,7 +429,7 @@ pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints) if (is_sub) { pgp_uid_t **l; - + k->flags |= KEYFLAG_SUBKEY; k->parent = mainkey; for (l = &k->address; *l; l = &(*l)->next) @@ -448,7 +448,6 @@ pgp_key_t pgp_get_candidates (pgp_ring_t keyring, LIST * hints) mutt_wait_filter (thepid); close (devnull); - + return db; } - diff --git a/group.c b/group.c index 2b1dc236..f37f52a0 100644 --- a/group.c +++ b/group.c @@ -205,4 +205,3 @@ int mutt_group_match (group_t *g, const char *s) } return 0; } - diff --git a/handler.c b/handler.c index 92ce1867..5621c142 100644 --- a/handler.c +++ b/handler.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002,2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -132,7 +132,7 @@ static void mutt_decode_xbit (STATE *s, long len, int istext, iconv_t cd) c = ch; len--; } - else + else ungetc(ch, s->fpin); } @@ -155,7 +155,7 @@ static int qp_decode_triple (char *s, char *d) /* soft line break */ if (*s == '=' && !(*(s+1))) return 1; - + /* quoted-printable triple */ if (*s == '=' && isxdigit ((unsigned char) *(s+1)) && @@ -164,7 +164,7 @@ static int qp_decode_triple (char *s, char *d) *d = (hexval (*(s+1)) << 4) | hexval (*(s+2)); return 0; } - + /* something else */ return -1; } @@ -179,7 +179,7 @@ static void qp_decode_line (char *dest, char *src, size_t *l, int soft = 0; /* decode the line */ - + for (d = dest, s = src; *s;) { switch ((kind = qp_decode_triple (s, &c))) @@ -200,33 +200,33 @@ static void qp_decode_line (char *dest, char *src, size_t *l, else *d++ = '\n'; } - + *d = '\0'; *l = d - dest; } -/* +/* * Decode an attachment encoded with quoted-printable. - * + * * Why doesn't this overflow any buffers? First, it's guaranteed * that the length of a line grows when you _en_-code it to * quoted-printable. That means that we always can store the * result in a buffer of at most the _same_ size. - * + * * Now, we don't special-case if the line we read with fgets() * isn't terminated. We don't care about this, since STRING > 78, * so corrupted input will just be corrupted a bit more. That * implies that STRING+1 bytes are always sufficient to store the * result of qp_decode_line. - * + * * Finally, at soft line breaks, some part of a multibyte character * may have been left over by mutt_convert_to_state(). This shouldn't * be more than 6 characters, so STRING + 7 should be sufficient * memory to store the decoded data. - * + * * Just to make sure that I didn't make some off-by-one error * above, we just use STRING*2 for the target buffer's size. - * + * */ static void mutt_decode_quoted (STATE *s, long len, int istext, iconv_t cd) @@ -236,16 +236,16 @@ static void mutt_decode_quoted (STATE *s, long len, int istext, iconv_t cd) size_t l = 0; size_t linelen; /* number of input bytes in `line' */ size_t l3; - + int last; /* store the last character in the input line */ - + if (istext) state_set_prefix(s); while (len > 0) { last = 0; - + /* * It's ok to use a fixed size buffer for input, even if the line turns * out to be longer than this. Just process the line in chunks. This @@ -292,7 +292,7 @@ void mutt_decode_base64 (STATE *s, long len, int istext, iconv_t cd) buf[4] = 0; - if (istext) + if (istext) state_set_prefix(s); while (len > 0) @@ -317,11 +317,11 @@ void mutt_decode_base64 (STATE *s, long len, int istext, iconv_t cd) c2 = base64val (buf[1]); ch = (c1 << 2) | (c2 >> 4); - if (cr && ch != '\n') + if (cr && ch != '\n') bufi[l++] = '\r'; cr = 0; - + if (istext && ch == '\r') cr = 1; else @@ -354,7 +354,7 @@ void mutt_decode_base64 (STATE *s, long len, int istext, iconv_t cd) cr = 1; else bufi[l++] = ch; - + if (l + 8 >= sizeof (bufi)) mutt_convert_to_state (cd, bufi, &l, s); } @@ -384,7 +384,7 @@ static void mutt_decode_uuencoded (STATE *s, long len, int istext, iconv_t cd) if(istext) state_set_prefix(s); - + while(len > 0) { if ((fgets(tmps, sizeof(tmps), s->fpin)) == NULL) @@ -422,7 +422,7 @@ static void mutt_decode_uuencoded (STATE *s, long len, int istext, iconv_t cd) mutt_convert_to_state (cd, bufi, &k, s); mutt_convert_to_state (cd, 0, 0, s); - + state_reset_prefix(s); } @@ -431,8 +431,8 @@ static void mutt_decode_uuencoded (STATE *s, long len, int istext, iconv_t cd) */ #define IndentSize (4) - -enum { RICH_PARAM=0, RICH_BOLD, RICH_UNDERLINE, RICH_ITALIC, RICH_NOFILL, + +enum { RICH_PARAM=0, RICH_BOLD, RICH_UNDERLINE, RICH_ITALIC, RICH_NOFILL, RICH_INDENT, RICH_INDENT_RIGHT, RICH_EXCERPT, RICH_CENTER, RICH_FLUSHLEFT, RICH_FLUSHRIGHT, RICH_COLOR, RICH_LAST_TAG }; @@ -519,9 +519,9 @@ static void enriched_wrap (struct enriched_state *stte) extra = stte->WrapMargin - stte->line_len - stte->indent_len - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize); - if (extra > 0) + if (extra > 0) { - if (stte->tag_level[RICH_CENTER]) + if (stte->tag_level[RICH_CENTER]) { x = extra / 2; while (x) @@ -529,7 +529,7 @@ static void enriched_wrap (struct enriched_state *stte) state_putc (' ', stte->s); x--; } - } + } else if (stte->tag_level[RICH_FLUSHRIGHT]) { x = extra-1; @@ -557,7 +557,7 @@ static void enriched_wrap (struct enriched_state *stte) if (stte->tag_level[RICH_EXCERPT]) { x = stte->tag_level[RICH_EXCERPT]; - while (x) + while (x) { if (stte->s->prefix) { @@ -578,7 +578,7 @@ static void enriched_wrap (struct enriched_state *stte) { x = stte->tag_level[RICH_INDENT] * IndentSize; stte->indent_len += x; - while (x) + while (x) { state_putc (' ', stte->s); x--; @@ -588,8 +588,8 @@ static void enriched_wrap (struct enriched_state *stte) static void enriched_flush (struct enriched_state *stte, int wrap) { - if (!stte->tag_level[RICH_NOFILL] && (stte->line_len + stte->word_len > - (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - + if (!stte->tag_level[RICH_NOFILL] && (stte->line_len + stte->word_len > + (stte->WrapMargin - (stte->tag_level[RICH_INDENT_RIGHT] * IndentSize) - stte->indent_len))) enriched_wrap (stte); @@ -615,9 +615,9 @@ static void enriched_flush (struct enriched_state *stte, int wrap) static void enriched_putwc (wchar_t c, struct enriched_state *stte) { - if (stte->tag_level[RICH_PARAM]) + if (stte->tag_level[RICH_PARAM]) { - if (stte->tag_level[RICH_COLOR]) + if (stte->tag_level[RICH_COLOR]) { if (stte->param_used + 1 >= stte->param_len) safe_realloc (&stte->param, (stte->param_len += STRING) * sizeof (wchar_t)); @@ -640,7 +640,7 @@ static void enriched_putwc (wchar_t c, struct enriched_state *stte) stte->word_len += 8 - (stte->line_len + stte->word_len) % 8; else stte->word_len++; - + stte->buffer[stte->buff_used++] = c; enriched_flush (stte, 0); } @@ -704,7 +704,7 @@ static void enriched_set_flags (const wchar_t *tag, struct enriched_state *stte) if (*tagptr == (wchar_t) '/') tagptr++; - + for (i = 0, j = -1; EnrichedTags[i].tag_name; i++) if (wcscasecmp (EnrichedTags[i].tag_name, tagptr) == 0) { @@ -830,7 +830,7 @@ static int text_enriched_handler (BODY *a, STATE *s) { enriched_flush (&stte, 1); } - else + else { enriched_putwc ((wchar_t) ' ', &stte); state = NEWLINE; @@ -902,7 +902,7 @@ static int text_enriched_handler (BODY *a, STATE *s) FREE (&(stte.param)); return 0; -} +} /* for compatibility with metamail */ static int is_mmnoask (const char *buf) @@ -973,7 +973,7 @@ static int mutt_is_autoview (BODY *b) mutt_check_lookup_list (b, type, sizeof (type)); for (; t; t = t->next) { int i = mutt_strlen (t->data) - 1; - if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && + if ((i > 0 && t->data[i-1] == '/' && t->data[i] == '*' && ascii_strncasecmp (type, t->data, i) == 0) || ascii_strcasecmp (type, t->data) == 0) is_autoview = 1; @@ -1042,7 +1042,7 @@ static int alternative_handler (BODY *a, STATE *s) btlen = mutt_strlen (t->data); } - if (a && a->parts) + if (a && a->parts) b = a->parts; else b = a; @@ -1065,7 +1065,7 @@ static int alternative_handler (BODY *a, STATE *s) /* Next, look for an autoviewable type */ if (!choice) { - if (a && a->parts) + if (a && a->parts) b = a->parts; else b = a; @@ -1080,7 +1080,7 @@ static int alternative_handler (BODY *a, STATE *s) /* Then, look for a text entry */ if (!choice) { - if (a && a->parts) + if (a && a->parts) b = a->parts; else b = a; @@ -1111,7 +1111,7 @@ static int alternative_handler (BODY *a, STATE *s) /* Finally, look for other possibilities */ if (!choice) { - if (a && a->parts) + if (a && a->parts) b = a->parts; else b = a; @@ -1155,7 +1155,7 @@ static int message_handler (BODY *a, STATE *s) int rc = 0; off_start = ftello (s->fpin); - if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE || + if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE || a->encoding == ENCUUENCODED) { fstat (fileno (s->fpin), &st); @@ -1183,7 +1183,7 @@ static int message_handler (BODY *a, STATE *s) if (a->encoding == ENCBASE64 || a->encoding == ENCQUOTEDPRINTABLE || a->encoding == ENCUUENCODED) mutt_free_body (&b); - + return rc; } @@ -1212,7 +1212,7 @@ int mutt_can_decode (BODY *a) if (mutt_can_decode (p)) return (1); } - + } else if (WithCrypto && a->type == TYPEAPPLICATION) { @@ -1261,7 +1261,7 @@ static int multipart_handler (BODY *a, STATE *s) state_puts (" --]\n", s); mutt_pretty_size (length, sizeof (length), p->length); - + state_mark_attach (s); state_printf (s, _("[-- Type: %s/%s, Encoding: %s, Size: %s --]\n"), TYPE (p), p->subtype, ENCODING (p->encoding), length); @@ -1276,13 +1276,13 @@ static int multipart_handler (BODY *a, STATE *s) rc = mutt_body_handler (p, s); state_putc ('\n', s); - + if (rc) { mutt_error (_("One or more parts of this message could not be displayed")); dprint (1, (debugfile, "Failed on attachment #%d, type %s/%s.\n", count, TYPE(p), NONULL (p->subtype))); } - + if ((s->flags & MUTT_REPLYING) && (option (OPTINCLUDEONLYFIRST)) && (s->flags & MUTT_FIRSTDONE)) break; @@ -1341,7 +1341,7 @@ static int autoview_handler (BODY *a, STATE *s) rfc1524_free_entry (&entry); return -1; } - + mutt_copy_bytes (s->fpin, fpin, a->length); if(!piped) @@ -1369,7 +1369,7 @@ static int autoview_handler (BODY *a, STATE *s) rc = -1; goto bail; } - + if (s->prefix) { while (fgets (buffer, sizeof(buffer), fpout) != NULL) @@ -1378,7 +1378,7 @@ static int autoview_handler (BODY *a, STATE *s) state_puts (buffer, s); } /* check for data on stderr */ - if (fgets (buffer, sizeof(buffer), fperr)) + if (fgets (buffer, sizeof(buffer), fperr)) { if (s->flags & MUTT_DISPLAY) { @@ -1404,10 +1404,10 @@ static int autoview_handler (BODY *a, STATE *s) if (s->flags & MUTT_DISPLAY) { state_mark_attach (s); - state_printf (s, _("[-- Autoview stderr of %s --]\n"), + state_printf (s, _("[-- Autoview stderr of %s --]\n"), command); } - + state_puts (buffer, s); mutt_copy_stream (fperr, s->fpout); } @@ -1423,7 +1423,7 @@ static int autoview_handler (BODY *a, STATE *s) else mutt_unlink (tempfile); - if (s->flags & MUTT_DISPLAY) + if (s->flags & MUTT_DISPLAY) mutt_clear_error (); } rfc1524_free_entry (&entry); @@ -1462,7 +1462,7 @@ static int external_body_handler (BODY *b, STATE *s) { char *length; char pretty_size[10]; - + state_mark_attach (s); state_printf (s, _("[-- This %s/%s attachment "), TYPE(b->parts), b->parts->subtype); @@ -1515,7 +1515,7 @@ static int external_body_handler (BODY *b, STATE *s) _("[-- This %s/%s attachment is not included, --]\n"), TYPE (b->parts), b->parts->subtype); state_mark_attach (s); - state_printf (s, + state_printf (s, _("[-- and the indicated access-type %s is unsupported --]\n"), access_type); mutt_copy_hdr (s->fpin, s->fpout, ftello (s->fpin), b->parts->offset, @@ -1523,7 +1523,7 @@ static int external_body_handler (BODY *b, STATE *s) CH_DECODE | CH_DISPLAY, NULL); } } - + return 0; } @@ -1751,7 +1751,7 @@ int mutt_body_handler (BODY *b, STATE *s) int rc = 0; int oflags = s->flags; - + /* first determine which handler to use to process this part */ if (mutt_is_autoview (b)) diff --git a/hash.c b/hash.c index 3747dee5..e9d6cb15 100644 --- a/hash.c +++ b/hash.c @@ -5,16 +5,16 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -120,7 +120,7 @@ HASH *int_hash_create (int nelem, int flags) /* table hash table to update * key key to hash on * data data to associate with `key' - * allow_dup if nonzero, duplicate keys are allowed in the table + * allow_dup if nonzero, duplicate keys are allowed in the table */ static int union_hash_insert (HASH * table, union hash_key key, void *data) { @@ -289,7 +289,7 @@ void int_hash_delete (HASH *table, unsigned int intkey, const void *data, } /* ptr pointer to the hash table to be freed - * destroy() function to call to free the ->data member (optional) + * destroy() function to call to free the ->data member (optional) */ void hash_destroy (HASH **ptr, void (*destroy) (void *)) { @@ -337,10 +337,9 @@ struct hash_elem *hash_walk(const HASH *table, struct hash_walk_state *state) return state->last; } state->index++; - } + } state->index = 0; state->last = NULL; return NULL; } - diff --git a/hash.h b/hash.h index 1ce37842..f143c57c 100644 --- a/hash.h +++ b/hash.h @@ -5,12 +5,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/hcache.c b/hcache.c index 08cfa921..160d5f30 100644 --- a/hcache.c +++ b/hcache.c @@ -601,7 +601,7 @@ mutt_hcache_per_folder(const char *path, const char *folder, char* s; int ret, plen; #ifndef HAVE_ICONV - const char *chs = Charset && *Charset ? Charset : + const char *chs = Charset && *Charset ? Charset : mutt_get_default_charset (); #endif @@ -669,7 +669,7 @@ mutt_hcache_per_folder(const char *path, const char *folder, ); #endif } - + if (ret <= 0) return path; @@ -800,7 +800,7 @@ mutt_hcache_fetch(header_cache_t *h, const char *filename, mutt_hcache_free (&data); return NULL; } - + return data; } @@ -849,7 +849,7 @@ mutt_hcache_fetch_raw (header_cache_t *h, const char *filename, strncpy(path, h->folder, sizeof (path)); safe_strcat(path, sizeof (path), filename); - ksize = strlen (h->folder) + keylen (path + strlen (h->folder)); + ksize = strlen (h->folder) + keylen (path + strlen (h->folder)); #endif #ifdef HAVE_QDBM @@ -899,15 +899,15 @@ mutt_hcache_store(header_cache_t *h, const char *filename, HEADER * header, char* data; int dlen; int ret; - + if (!h) return -1; - + data = mutt_hcache_dump(h, header, &dlen, uidvalidity, flags); ret = mutt_hcache_store_raw (h, filename, data, dlen, keylen); - + FREE(&data); - + return ret; } diff --git a/hdrline.c b/hdrline.c index 5e79d32d..9b37f2fd 100644 --- a/hdrline.c +++ b/hdrline.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002,2007 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -176,7 +176,7 @@ int mutt_user_is_recipient (HEADER *h) if(!h->recip_valid) { h->recip_valid = 1; - + if (mutt_addr_is_user (env->from)) h->recipient = 4; else if (user_in_addr (env->to)) @@ -195,7 +195,7 @@ int mutt_user_is_recipient (HEADER *h) else h->recipient = 0; } - + return h->recipient; } @@ -316,12 +316,12 @@ hdr_format_str (char *dest, else strfcpy (dest, ctx->path, destlen); } - else + else strfcpy(dest, "(null)", destlen); strfcpy (buf2, dest, sizeof(buf2)); mutt_format_s (dest, destlen, prefix, buf2); break; - + case 'c': mutt_pretty_size (buf2, sizeof (buf2), (long) hdr->content->length); mutt_format_s (dest, destlen, prefix, buf2); @@ -342,7 +342,7 @@ hdr_format_str (char *dest, /* preprocess $date_format to handle %Z */ { const char *cp; - struct tm *tm; + struct tm *tm; time_t T; p = dest; @@ -358,7 +358,7 @@ hdr_format_str (char *dest, len = destlen - 1; while (len > 0 && (((op == 'd' || op == 'D') && *cp) || - (op == '{' && *cp != '}') || + (op == '{' && *cp != '}') || (op == '[' && *cp != ']') || (op == '(' && *cp != ')') || (op == '<' && *cp != '>'))) @@ -662,7 +662,7 @@ hdr_format_str (char *dest, break; case 'v': - if (mutt_addr_is_user (hdr->env->from)) + if (mutt_addr_is_user (hdr->env->from)) { if (hdr->env->to) mutt_format_s (buf2, sizeof (buf2), prefix, mutt_get_name (hdr->env->to)); @@ -679,7 +679,7 @@ hdr_format_str (char *dest, break; case 'Z': - + ch = ' '; if (WithCrypto && hdr->security & GOODSIGN) @@ -722,7 +722,7 @@ hdr_format_str (char *dest, mutt_format_s (dest, destlen, prefix, NONULL (hdr->env->x_label)); break; - + case 'Y': if (hdr->env->x_label) { diff --git a/headers.c b/headers.c index e1a15d7f..0a67fe50 100644 --- a/headers.c +++ b/headers.c @@ -1,16 +1,16 @@ -/* +/* * Copyright (C) 1996-2009,2012 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -51,7 +51,7 @@ void mutt_edit_headers (const char *editor, mutt_perror (path); return; } - + mutt_env_to_local (msg->env); mutt_write_rfc822_header (ofp, msg->env, NULL, MUTT_WRITE_HEADER_EDITHDRS, 0, 0); fputc ('\n', ofp); /* tie off the header. */ @@ -95,7 +95,7 @@ void mutt_edit_headers (const char *editor, mutt_perror (path); return; } - + if ((ofp = safe_fopen (body, "w")) == NULL) { /* intentionally leak a possible temporary file here */ @@ -103,7 +103,7 @@ void mutt_edit_headers (const char *editor, mutt_perror (body); return; } - + n = mutt_read_rfc822_header (ifp, NULL, 1, 0); while ((i = fread (buffer, 1, sizeof (buffer), ifp)) > 0) fwrite (buffer, 1, i, ofp); @@ -130,7 +130,7 @@ void mutt_edit_headers (const char *editor, mutt_expand_aliases_env (msg->env); - /* search through the user defined headers added to see if + /* search through the user defined headers added to see if * fcc: or attach: or pgp: was specified */ diff --git a/help.c b/help.c index ab3d0ff4..64c9bd8f 100644 --- a/help.c +++ b/help.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2009 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #define HELP_C @@ -41,7 +41,7 @@ static const struct binding_t *help_lookupFunction (int op, int menu) /* first look in the generic map for the function */ for (i = 0; OpGeneric[i].name; i++) if (OpGeneric[i].op == op) - return (&OpGeneric[i]); + return (&OpGeneric[i]); } if ((map = km_get_table(menu))) @@ -50,7 +50,7 @@ static const struct binding_t *help_lookupFunction (int op, int menu) if (map[i].op == op) return (&map[i]); } - + return (NULL); } @@ -71,7 +71,7 @@ mutt_compile_help (char *buf, size_t buflen, int menu, const struct mapping_t *i int i; size_t len; char *pbuf = buf; - + for (i = 0; items[i].name && buflen > 2; i++) { if (i) @@ -350,29 +350,29 @@ void mutt_help (int menu) desc = mutt_getnamebyvalue (menu, Menus); if (!desc) desc = _(""); - + do { if ((f = safe_fopen (t, "w")) == NULL) { mutt_perror (t); return; } - + dump_menu (f, menu); if (menu != MENU_EDITOR && menu != MENU_PAGER) { fputs (_("\nGeneric bindings:\n\n"), f); dump_menu (f, MENU_GENERIC); } - + fputs (_("\nUnbound functions:\n\n"), f); if (funcs) dump_unbound (f, funcs, Keymaps[menu], NULL); if (menu != MENU_PAGER) dump_unbound (f, OpGeneric, Keymaps[MENU_GENERIC], Keymaps[menu]); - + safe_fclose (&f); - + snprintf (buf, sizeof (buf), _("Help for %s"), desc); } while diff --git a/history.c b/history.c index 15024aab..21b3a1d2 100644 --- a/history.c +++ b/history.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -69,7 +69,7 @@ struct history char **hist; short cur; short last; -}; +}; static const struct mapping_t HistoryHelp[] = { { N_("Exit"), OP_EXIT }, @@ -99,10 +99,10 @@ static void init_history (struct history *h) FREE (&h->hist); } } - + if (HistSize) h->hist = safe_calloc (HistSize + 1, sizeof (char *)); - + h->cur = 0; h->last = 0; } @@ -370,16 +370,16 @@ static void remove_history_dups (history_class_t hclass, const char *s) void mutt_init_history(void) { history_class_t hclass; - + if (HistSize == OldSize) return; - + for(hclass = HC_FIRST; hclass < HC_LAST; hclass++) init_history(&History[hclass]); OldSize = HistSize; } - + void mutt_history_add (history_class_t hclass, const char *s, int save) { int prev; @@ -587,4 +587,3 @@ void mutt_history_complete (char *buf, size_t buflen, history_class_t hclass) } FREE(&matches); } - diff --git a/history.h b/history.h index 76860056..7a3b4ff6 100644 --- a/history.h +++ b/history.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _HISTORY_H #define _HISTORY_H diff --git a/hook.c b/hook.c index 6cfe50a6..0d1c43b5 100644 --- a/hook.c +++ b/hook.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (C) 1996-2002,2004,2007 Michael R. Elkins , and others * * This program is free software; you can redistribute it and/or modify @@ -464,7 +464,7 @@ void mutt_folder_hook (char *path) } FREE (&token.data); FREE (&err.data); - + current_hook_type = 0; } diff --git a/imap/auth.c b/imap/auth.c index 1b26077a..0474b167 100644 --- a/imap/auth.c +++ b/imap/auth.c @@ -2,21 +2,21 @@ * Copyright (C) 1996-1998 Michael R. Elkins * Copyright (C) 1996-1999 Brandon Long * Copyright (C) 1999-2001 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* IMAP login/authentication code */ @@ -69,7 +69,7 @@ int imap_authenticate (IMAP_DATA* idata) *delim++ = '\0'; if (! method[0]) continue; - + dprint (2, (debugfile, "imap_authenticate: Trying method %s\n", method)); authenticator = imap_authenticators; @@ -83,7 +83,7 @@ int imap_authenticate (IMAP_DATA* idata) FREE (&methods); return r; } - + authenticator++; } } @@ -109,6 +109,6 @@ int imap_authenticate (IMAP_DATA* idata) mutt_error (_("No authenticators available")); mutt_sleep (1); } - + return r; } diff --git a/imap/auth.h b/imap/auth.h index 82ef2f4c..6ae33fc6 100644 --- a/imap/auth.h +++ b/imap/auth.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2001 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* common defs for authenticators. A good place to set up a generic callback * system */ diff --git a/imap/auth_anon.c b/imap/auth_anon.c index ba2c01fb..163146b3 100644 --- a/imap/auth_anon.c +++ b/imap/auth_anon.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2001,2005 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* IMAP login/authentication code */ @@ -59,7 +59,7 @@ imap_auth_res_t imap_auth_anon (IMAP_DATA* idata, const char* method) do rc = imap_cmd_step (idata); while (rc == IMAP_CMD_CONTINUE); - + if (rc != IMAP_CMD_OK) { dprint (1, (debugfile, "Error receiving server response.\n")); diff --git a/imap/auth_cram.c b/imap/auth_cram.c index 87617215..1996cdc3 100644 --- a/imap/auth_cram.c +++ b/imap/auth_cram.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2001,2005 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* IMAP login/authentication code */ @@ -64,7 +64,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA* idata, const char* method) do rc = imap_cmd_step (idata); while (rc == IMAP_CMD_CONTINUE); - + if (rc != IMAP_CMD_RESPOND) { dprint (1, (debugfile, "Invalid response from server: %s\n", ibuf)); @@ -85,7 +85,7 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA* idata, const char* method) * computed by applying the keyed MD5 algorithm from [KEYED-MD5] where the * key is a shared secret and the digested text is the timestamp (including * angle-brackets). - * + * * Note: The user name shouldn't be quoted. Since the digest can't contain * spaces, there is no ambiguity. Some servers get this wrong, we'll work * around them when the bug report comes in. Until then, we'll remain @@ -102,10 +102,10 @@ imap_auth_res_t imap_auth_cram_md5 (IMAP_DATA* idata, const char* method) hmac_response[12], hmac_response[13], hmac_response[14], hmac_response[15]); dprint(2, (debugfile, "CRAM response: %s\n", obuf)); - /* XXX - ibuf must be long enough to store the base64 encoding of obuf, + /* XXX - ibuf must be long enough to store the base64 encoding of obuf, * plus the additional debris */ - + mutt_to_base64 ((unsigned char*) ibuf, (unsigned char*) obuf, strlen (obuf), sizeof (ibuf) - 2); safe_strcat (ibuf, sizeof (ibuf), "\r\n"); diff --git a/imap/auth_gss.c b/imap/auth_gss.c index e14f4aac..8376e5a0 100644 --- a/imap/auth_gss.c +++ b/imap/auth_gss.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2001,2005,2009 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* GSS login/authentication code * @@ -51,13 +51,13 @@ #define GSS_AUTH_P_PRIVACY 4 static void print_gss_error(OM_uint32 err_maj, OM_uint32 err_min) { - OM_uint32 maj_stat, min_stat; + OM_uint32 maj_stat, min_stat; OM_uint32 msg_ctx = 0; gss_buffer_desc status_string; char buf_maj[512]; char buf_min[512]; size_t status_len; - + do { maj_stat = gss_display_status (&min_stat, @@ -74,7 +74,7 @@ static void print_gss_error(OM_uint32 err_maj, OM_uint32 err_min) strncpy(buf_maj, (char*) status_string.value, status_len); buf_maj[status_len] = '\0'; gss_release_buffer(&min_stat, &status_string); - + maj_stat = gss_display_status (&min_stat, err_min, GSS_C_MECH_CODE, @@ -91,7 +91,7 @@ static void print_gss_error(OM_uint32 err_maj, OM_uint32 err_min) gss_release_buffer(&min_stat, &status_string); } } while (!GSS_ERROR(maj_stat) && msg_ctx != 0); - + dprint (2, (debugfile, "((%s:%d )(%s:%d))", buf_maj, err_maj, buf_min, err_min)); } @@ -118,7 +118,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata, const char* method) if (mutt_account_getuser (&idata->conn->account)) return IMAP_AUTH_FAILURE; - + /* get an IMAP service ticket for the server */ snprintf (buf1, sizeof (buf1), "imap@%s", idata->conn->account.host); request_buf.value = buf1; @@ -130,7 +130,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata, const char* method) dprint (2, (debugfile, "Couldn't get service name for [%s]\n", buf1)); return IMAP_AUTH_UNAVAIL; } -#ifdef DEBUG +#ifdef DEBUG else if (debuglevel >= 2) { maj_stat = gss_display_name (&min_stat, target_name, &request_buf, @@ -146,7 +146,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata, const char* method) /* build token */ maj_stat = gss_init_sec_context (&min_stat, GSS_C_NO_CREDENTIAL, &context, - target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0, + target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0, GSS_C_NO_CHANNEL_BINDINGS, sec_token, NULL, &send_token, (unsigned int*) &cflags, NULL); if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) @@ -203,7 +203,7 @@ imap_auth_res_t imap_auth_gss (IMAP_DATA* idata, const char* method) /* Write client data */ maj_stat = gss_init_sec_context (&min_stat, GSS_C_NO_CREDENTIAL, &context, - target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0, + target_name, GSS_C_NO_OID, GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG, 0, GSS_C_NO_CHANNEL_BINDINGS, sec_token, NULL, &send_token, (unsigned int*) &cflags, NULL); if (maj_stat != GSS_S_COMPLETE && maj_stat != GSS_S_CONTINUE_NEEDED) diff --git a/imap/auth_login.c b/imap/auth_login.c index 00651130..b56a5917 100644 --- a/imap/auth_login.c +++ b/imap/auth_login.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2001,2005,2009 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* plain LOGIN support */ @@ -60,7 +60,7 @@ imap_auth_res_t imap_auth_login (IMAP_DATA* idata, const char* method) snprintf (buf, sizeof (buf), "LOGIN %s %s", q_user, q_pass); rc = imap_exec (idata, buf, IMAP_CMD_FAIL_OK | IMAP_CMD_PASS); - + if (!rc) { mutt_clear_error(); /* clear "Logging in...". fixes #3524 */ diff --git a/imap/auth_oauth.c b/imap/auth_oauth.c index 14e843a5..54970714 100644 --- a/imap/auth_oauth.c +++ b/imap/auth_oauth.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1999-2001,2005 Brendan Cully * Copyright (C) 2018 Brandon Long - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* IMAP login/authentication code */ @@ -59,7 +59,7 @@ imap_auth_res_t imap_auth_oauth (IMAP_DATA* idata, const char* method) FREE (&oauthbearer); FREE (&ibuf); - + if (rc) { /* The error response was in SASL continuation, so continue the SASL diff --git a/imap/auth_sasl.c b/imap/auth_sasl.c index bd059dc1..ef6d2e92 100644 --- a/imap/auth_sasl.c +++ b/imap/auth_sasl.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2006,2012 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* SASL login/authentication code */ @@ -70,7 +70,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) if (mutt_bit_isset (idata->capabilities, AUTH_ANON) && (!idata->conn->account.user[0] || !ascii_strncmp (idata->conn->account.user, "anonymous", 9))) - rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen, + rc = sasl_client_start (saslconn, "AUTH=ANONYMOUS", NULL, &pc, &olen, &mech); } else if (!ascii_strcasecmp ("login", method) && !strstr (NONULL (idata->capstr), "AUTH=LOGIN")) { @@ -78,7 +78,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) sasl_dispose (&saslconn); return IMAP_AUTH_UNAVAIL; } - + if (rc != SASL_OK && rc != SASL_CONTINUE) do { @@ -189,7 +189,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) goto bail; } } - + if (irc == IMAP_CMD_RESPOND) { strfcpy (buf + olen, "\r\n", bufsize - olen); @@ -202,7 +202,7 @@ imap_auth_res_t imap_auth_sasl (IMAP_DATA* idata, const char* method) mutt_socket_write (idata->conn, "*\r\n"); dprint (1, (debugfile, "imap_auth_sasl: sasl_client_step error %d\n",rc)); } - + olen = 0; } diff --git a/imap/browse.c b/imap/browse.c index aada493d..ab62f576 100644 --- a/imap/browse.c +++ b/imap/browse.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-1999 Brandon Long * Copyright (C) 1999-2008 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* Mutt browser support routines */ @@ -124,7 +124,7 @@ int imap_browse (char* path, struct browser_state* state) * Note: UW-IMAP servers return folder + delimiter when asked to list * folder + delimiter. Cyrus servers don't. So we ask for folder, * and tack on delimiter ourselves. - * Further note: UW-IMAP servers return nothing when asked for + * Further note: UW-IMAP servers return nothing when asked for * NAMESPACES without delimiters at the end. Argh! */ for (n--; n >= 0 && mbox[n] != list.delim ; n--); if (n > 0) /* "aaaa/bbbb/" -> "aaaa" */ @@ -151,7 +151,7 @@ int imap_browse (char* path, struct browser_state* state) state->folder = safe_strdup (buf); } mbox[n] = ctmp; - } + } /* "/bbbb/" -> add "/", "aaaa/" -> add "" */ else { @@ -159,7 +159,7 @@ int imap_browse (char* path, struct browser_state* state) /* folder may be "/" */ snprintf (relpath, sizeof (relpath), "%c" , n < 0 ? '\0' : idata->delim); if (showparents) - imap_add_folder (idata->delim, relpath, 1, 0, state, 1); + imap_add_folder (idata->delim, relpath, 1, 0, state, 1); if (!state->folder) { imap_qualify_path (buf, sizeof (buf), &mx, relpath); @@ -229,7 +229,7 @@ int imap_mailbox_create (const char* folder) dprint (1, (debugfile, "imap_mailbox_create: Couldn't find open connection to %s", mx.account.host)); goto fail; } - + strfcpy (buf, NONULL (mx.mbox), sizeof (buf)); /* append a delimiter if necessary */ @@ -239,7 +239,7 @@ int imap_mailbox_create (const char* folder) buf[n++] = idata->delim; buf[n] = '\0'; } - + if (mutt_get_field (_("Create mailbox: "), buf, sizeof (buf), MUTT_FILE) < 0) goto fail; @@ -249,7 +249,7 @@ int imap_mailbox_create (const char* folder) mutt_sleep(1); goto fail; } - + if (imap_create_mailbox (idata, buf) < 0) goto fail; @@ -292,7 +292,7 @@ int imap_mailbox_rename(const char* mailbox) snprintf(buf, sizeof (buf), _("Rename mailbox %s to: "), mx.mbox); strfcpy (newname, mx.mbox, sizeof (newname)); - + if (mutt_get_field (buf, newname, sizeof (newname), MUTT_FILE) < 0) goto fail; @@ -414,7 +414,7 @@ static void imap_add_folder (char delim, char *folder, int noselect, relpath[strlen (relpath) + 1] = '\0'; relpath[strlen (relpath)] = delim; } - + (state->entry)[state->entrylen].desc = safe_strdup (relpath); (state->entry)[state->entrylen].imap = 1; @@ -447,7 +447,7 @@ static void imap_add_folder (char delim, char *folder, int noselect, FREE (&mx.mbox); } -static int compare_names(struct folder_file *a, struct folder_file *b) +static int compare_names(struct folder_file *a, struct folder_file *b) { return mutt_strcmp(a->name, b->name); } diff --git a/imap/command.c b/imap/command.c index 6d7c6f28..8c985927 100644 --- a/imap/command.c +++ b/imap/command.c @@ -2,21 +2,21 @@ * Copyright (C) 1996-1998,2010,2012 Michael R. Elkins * Copyright (C) 1996-1999 Brandon Long * Copyright (C) 1999-2009,2011 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* command.c: routines for sending commands to an IMAP server and parsing * responses */ @@ -60,7 +60,7 @@ static const char * const Capabilities[] = { "IMAP4", "IMAP4rev1", "STATUS", - "ACL", + "ACL", "NAMESPACE", "AUTH=CRAM-MD5", "AUTH=GSSAPI", @@ -195,7 +195,7 @@ int imap_cmd_step (IMAP_DATA* idata) dprint (3, (debugfile, "IMAP queue drained\n")); imap_cmd_finish (idata); } - + return rc; } @@ -301,7 +301,7 @@ void imap_cmd_finish (IMAP_DATA* idata) if (!(idata->state >= IMAP_SELECTED) || idata->ctx->closing) return; - + if (idata->reopen & IMAP_REOPEN_ALLOW) { unsigned int count = idata->newMailCount; @@ -370,7 +370,7 @@ int imap_cmd_idle (IMAP_DATA* idata) dprint (1, (debugfile, "imap_cmd_idle: error starting IDLE\n")); return -1; } - + return 0; } @@ -465,7 +465,7 @@ static int cmd_start (IMAP_DATA* idata, const char* cmdstr, int flags) static int cmd_status (const char *s) { s = imap_next_word((char*)s); - + if (!ascii_strncasecmp("OK", s, 2)) return IMAP_CMD_OK; if (!ascii_strncasecmp("NO", s, 2)) @@ -931,7 +931,7 @@ static void cmd_parse_list (IMAP_DATA* idata, char* s) /* See draft-gahrns-imap-child-mailbox-?? */ else if (!ascii_strncasecmp (s, "\\HasNoChildren", 14)) list->noinferiors = 1; - + s = imap_next_word (s); if (*(s - 2) == ')') break; @@ -941,7 +941,7 @@ static void cmd_parse_list (IMAP_DATA* idata, char* s) if (ascii_strncasecmp (s, "NIL", 3)) { delimbuf[0] = '\0'; - safe_strcat (delimbuf, 5, s); + safe_strcat (delimbuf, 5, s); imap_unquote_string (delimbuf); list->delim = delimbuf[0]; } @@ -1032,7 +1032,7 @@ static void cmd_parse_myrights (IMAP_DATA* idata, const char* s) while (*s && !isspace((unsigned char) *s)) { - switch (*s) + switch (*s) { case 'l': mutt_bit_set (idata->ctx->rights, MUTT_ACL_LOOKUP); @@ -1207,14 +1207,14 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) { if (inc->magic != MUTT_IMAP) continue; - + if (imap_parse_path (inc->path, &mx) < 0) { dprint (1, (debugfile, "Error parsing mailbox %s, skipping\n", inc->path)); continue; } /* dprint (2, (debugfile, "Buffy entry: [%s] mbox: [%s]\n", inc->path, NONULL(mx.mbox))); */ - + if (imap_account_match (&idata->conn->account, &mx.account)) { if (mx.mbox) @@ -1230,7 +1230,7 @@ static void cmd_parse_status (IMAP_DATA* idata, char* s) { dprint (3, (debugfile, "Found %s in buffy list (OV: %u ON: %u U: %d)\n", mailbox, olduv, oldun, status->unseen)); - + if (option(OPTMAILCHECKRECENT)) { if (olduv && olduv == status->uidvalidity) diff --git a/imap/imap_private.h b/imap/imap_private.h index d1b9ff42..654fd77e 100644 --- a/imap/imap_private.h +++ b/imap/imap_private.h @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-1999 Brandon Long * Copyright (C) 1999-2009 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _IMAP_PRIVATE_H #define _IMAP_PRIVATE_H 1 @@ -88,7 +88,7 @@ enum IMAP_CONNECTED, IMAP_AUTHENTICATED, IMAP_SELECTED, - + /* and pseudo-states */ IMAP_IDLE }; @@ -191,7 +191,7 @@ typedef struct time_t lastread; /* last time we read a command for the server */ char* buf; unsigned int blen; - + /* If nonzero, we can send UTF-8, and the server will use UTF8 rather * than mUTF7 */ int unicode; @@ -311,7 +311,7 @@ int imap_continue (const char* msg, const char* resp); void imap_error (const char* where, const char* msg); IMAP_DATA* imap_new_idata (void); void imap_free_idata (IMAP_DATA** idata); -char* imap_fix_path (IMAP_DATA* idata, const char* mailbox, char* path, +char* imap_fix_path (IMAP_DATA* idata, const char* mailbox, char* path, size_t plen); void imap_cachepath(IMAP_DATA* idata, const char* mailbox, char* dest, size_t dlen); diff --git a/imap/message.h b/imap/message.h index 864b7746..11b549fd 100644 --- a/imap/message.h +++ b/imap/message.h @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-1999 Brandon Long * Copyright (C) 1999-2000,2005 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* message.c data structures */ diff --git a/imap/utf7.c b/imap/utf7.c index ed8723c8..49582365 100644 --- a/imap/utf7.c +++ b/imap/utf7.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000,2003 Edmund Grimley Evans - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" diff --git a/imap/util.c b/imap/util.c index b675aac9..b4397541 100644 --- a/imap/util.c +++ b/imap/util.c @@ -1067,4 +1067,3 @@ void mutt_seqset_iterator_free (SEQSET_ITERATOR **p_iter) FREE (&iter->full_seqset); FREE (p_iter); /* __FREE_CHECKED__ */ } - diff --git a/init.c b/init.c index a682ab23..880a9139 100644 --- a/init.c +++ b/init.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2010,2013,2016 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -263,7 +263,7 @@ int mutt_extract_token (BUFFER *dest, BUFFER *tok, int flags) /* if we got output, make a new string consisting of the shell output plus whatever else was left on the original line */ - /* BUT: If this is inside a quoted string, directly add output to + /* BUT: If this is inside a quoted string, directly add output to * the token */ if (expn.data && qc) { @@ -657,7 +657,7 @@ static int parse_unignore (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *e mutt_extract_token (buf, s, 0); /* don't add "*" to the unignore list */ - if (strcmp (buf->data, "*")) + if (strcmp (buf->data, "*")) add_to_list (&UnIgnore, buf->data); remove_from_list (&Ignore, buf->data); @@ -711,7 +711,7 @@ static int parse_echo (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) static void _alternates_clean (void) { int i; - if (Context && Context->msgcount) + if (Context && Context->msgcount) { for (i = 0; i < Context->msgcount; i++) Context->hdrs[i]->recip_valid = 0; @@ -721,7 +721,7 @@ static void _alternates_clean (void) static int parse_alternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { group_context_t *gc = NULL; - + _alternates_clean(); do @@ -740,10 +740,10 @@ static int parse_alternates (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER goto bail; } while (MoreArgs (s)); - + mutt_group_context_destroy (&gc); return 0; - + bail: mutt_group_context_destroy (&gc); return -1; @@ -827,7 +827,7 @@ static int parse_unreplace_list (BUFFER *buf, BUFFER *s, unsigned long data, BUF static void clear_subject_mods (void) { int i; - if (Context && Context->msgcount) + if (Context && Context->msgcount) { for (i = 0; i < Context->msgcount; i++) FREE(&Context->hdrs[i]->env->disp_subj); @@ -1005,15 +1005,15 @@ static int parse_lists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) do { mutt_extract_token (buf, s, 0); - + if (parse_group_context (&gc, buf, s, data, err) == -1) goto bail; - + mutt_remove_from_rx_list (&UnMailLists, buf->data); - + if (mutt_add_to_rx_list (&MailLists, buf->data, REG_ICASE, err) != 0) goto bail; - + if (mutt_group_context_add_rx (gc, buf->data, REG_ICASE, err) != 0) goto bail; } @@ -1021,7 +1021,7 @@ static int parse_lists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) mutt_group_context_destroy (&gc); return 0; - + bail: mutt_group_context_destroy (&gc); return -1; @@ -1107,7 +1107,7 @@ bail: static void _attachments_clean (void) { int i; - if (Context && Context->msgcount) + if (Context && Context->msgcount) { for (i = 0; i < Context->msgcount; i++) Context->hdrs[i]->attach_valid = 0; @@ -1141,7 +1141,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *err) if (!buf->data || *buf->data == '\0') continue; - + a = safe_malloc(sizeof(ATTACH_MATCH)); /* some cheap hacks that I expect to remove */ @@ -1200,7 +1200,7 @@ static int parse_attach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *err) lastp = listp; } while (MoreArgs (s)); - + _attachments_clean(); return 0; } @@ -1269,7 +1269,7 @@ static int parse_unattach_list (BUFFER *buf, BUFFER *s, LIST **ldata, BUFFER *er } while (MoreArgs (s)); - + FREE(&tmp); _attachments_clean(); return 0; @@ -1383,8 +1383,8 @@ static int parse_unlists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er mutt_extract_token (buf, s, 0); mutt_remove_from_rx_list (&SubscribedLists, buf->data); mutt_remove_from_rx_list (&MailLists, buf->data); - - if (mutt_strcmp (buf->data, "*") && + + if (mutt_strcmp (buf->data, "*") && mutt_add_to_rx_list (&UnMailLists, buf->data, REG_ICASE, err) != 0) return -1; } @@ -1396,14 +1396,14 @@ static int parse_unlists (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er static int parse_subscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { group_context_t *gc = NULL; - + do { mutt_extract_token (buf, s, 0); if (parse_group_context (&gc, buf, s, data, err) == -1) goto bail; - + mutt_remove_from_rx_list (&UnMailLists, buf->data); mutt_remove_from_rx_list (&UnSubscribedLists, buf->data); @@ -1415,10 +1415,10 @@ static int parse_subscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER * goto bail; } while (MoreArgs (s)); - + mutt_group_context_destroy (&gc); return 0; - + bail: mutt_group_context_destroy (&gc); return -1; @@ -1431,7 +1431,7 @@ static int parse_unsubscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER { mutt_extract_token (buf, s, 0); mutt_remove_from_rx_list (&SubscribedLists, buf->data); - + if (mutt_strcmp (buf->data, "*") && mutt_add_to_rx_list (&UnSubscribedLists, buf->data, REG_ICASE, err) != 0) return -1; @@ -1440,7 +1440,7 @@ static int parse_unsubscribe (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER return 0; } - + static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { ALIAS *tmp, *last = NULL; @@ -1453,7 +1453,7 @@ static int parse_unalias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *er { if (CurrentMenu == MENU_ALIAS) { - for (tmp = Aliases; tmp ; tmp = tmp->next) + for (tmp = Aliases; tmp ; tmp = tmp->next) tmp->del = 1; mutt_set_current_menu_redraw_full (); } @@ -1494,7 +1494,7 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) ALIAS *last = NULL; char *estr = NULL; group_context_t *gc = NULL; - + if (!MoreArgs (s)) { strfcpy (err->data, _("alias: no address"), err->dsize); @@ -1505,7 +1505,7 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) if (parse_group_context (&gc, buf, s, data, err) == -1) return -1; - + /* check to see if an alias with this name already exists */ for (; tmp; tmp = tmp->next) { @@ -1555,7 +1555,7 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) mutt_alias_add_reverse (tmp); #ifdef DEBUG - if (debuglevel >= 2) + if (debuglevel >= 2) { ADDRESS *a; /* A group is terminated with an empty address, so check a->mailbox */ @@ -1572,7 +1572,7 @@ static int parse_alias (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) #endif mutt_group_context_destroy (&gc); return 0; - + bail: mutt_group_context_destroy (&gc); return -1; @@ -1678,7 +1678,7 @@ parse_sort (short *val, const char *s, const struct mapping_t *map, BUFFER *err) s += 8; flags = SORT_REVERSE; } - + if (mutt_strncmp ("last-", s, 5) == 0) { s += 5; @@ -1736,7 +1736,7 @@ static void mutt_restore_default (struct option_t *p) switch (p->type & DT_MASK) { case DT_STR: - mutt_str_replace ((char **) p->data, (char *) p->init); + mutt_str_replace ((char **) p->data, (char *) p->init); break; case DT_MBCHARTBL: free_mbchar_table ((mbchar_table **)p->data); @@ -2136,7 +2136,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) snprintf (err->data, err->dsize, "%s", _("value is illegal with reset")); return (-1); } - + if (!mutt_strcmp ("all", tmp->data)) { if (CurrentMenu == MENU_PAGER) @@ -2161,9 +2161,9 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) else mutt_restore_default (&MuttVars[idx]); } - } + } else if (!myvar && DTYPE (MuttVars[idx].type) == DT_BOOL) - { + { if (s && *s->dptr == '=') { if (unset || inv || query) @@ -2215,7 +2215,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) else if (DTYPE (MuttVars[idx].type) == DT_MBCHARTBL) free_mbchar_table ((mbchar_table **) MuttVars[idx].data); else - /* MuttVars[idx].data is already 'char**' (or some 'void**') or... + /* MuttVars[idx].data is already 'char**' (or some 'void**') or... * so cast to 'void*' is okay */ FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */ } @@ -2257,7 +2257,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) } else val = *((char **) MuttVars[idx].data); - + /* user requested the value of this variable */ pretty_var (err->data, err->dsize, MuttVars[idx].option, NONULL(val)); break; @@ -2284,7 +2284,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) } else if (DTYPE (MuttVars[idx].type) == DT_PATH) { - /* MuttVars[idx].data is already 'char**' (or some 'void**') or... + /* MuttVars[idx].data is already 'char**' (or some 'void**') or... * so cast to 'void*' is okay */ FREE ((void *) MuttVars[idx].data); /* __FREE_CHECKED__ */ @@ -2338,7 +2338,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) r = -1; break; } - + CHECK_PAGER; s->dptr++; @@ -2362,7 +2362,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) p++; } } - + rx = (regex_t *) safe_malloc (sizeof (regex_t)); if ((e = REGCOMP (rx, p, flags)) != 0) { @@ -2384,13 +2384,13 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) ptr->not = not; /* $reply_regexp and $alterantes require special treatment */ - + if (Context && Context->msgcount && mutt_strcmp (MuttVars[idx].option, "reply_regexp") == 0) { regmatch_t pmatch[1]; int i; - + #define CUR_ENV Context->hdrs[i]->env for (i = 0; i < Context->msgcount; i++) { @@ -2398,7 +2398,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) { CUR_ENV->real_subj = (regexec (ReplyRegexp.rx, CUR_ENV->subject, 1, pmatch, 0)) ? - CUR_ENV->subject : + CUR_ENV->subject : CUR_ENV->subject + pmatch[0].rm_eo; } } @@ -2617,7 +2617,7 @@ static int parse_set (BUFFER *tmp, BUFFER *s, unsigned long data, BUFFER *err) r = -1; break; } - + if (query || *s->dptr != '=') { p = mutt_getnamebyvalue (*((short *) MuttVars[idx].data) & SORT_MASK, map); @@ -2693,7 +2693,7 @@ static int source_rc (const char *rcfile, BUFFER *err) dprint (2, (debugfile, "Reading configuration file '%s'.\n", rcfile)); - + if ((f = mutt_open_read (rcfile, &pid)) == NULL) { snprintf (err->data, err->dsize, "%s: %s", rcfile, strerror (errno)); @@ -2704,19 +2704,19 @@ static int source_rc (const char *rcfile, BUFFER *err) while ((linebuf = mutt_read_line (linebuf, &buflen, f, &line, MUTT_CONT)) != NULL) { conv=ConfigCharset && (*ConfigCharset) && Charset; - if (conv) + if (conv) { currentline=safe_strdup(linebuf); if (!currentline) continue; mutt_convert_string(¤tline, ConfigCharset, Charset, 0); - } - else + } + else currentline=linebuf; if (mutt_parse_rc_line (currentline, &token, err) == -1) { mutt_error (_("Error in %s, line %d: %s"), rcfile, line, err->data); - if (--rc < -MAXERRS) + if (--rc < -MAXERRS) { if (conv) FREE(¤tline); break; @@ -2727,7 +2727,7 @@ static int source_rc (const char *rcfile, BUFFER *err) if (rc < 0) rc = -1; } - if (conv) + if (conv) FREE(¤tline); } FREE (&token.data); @@ -2826,9 +2826,9 @@ finish: #define NUMVARS (sizeof (MuttVars)/sizeof (MuttVars[0])) #define NUMCOMMANDS (sizeof (Commands)/sizeof (Commands[0])) -/* initial string that starts completion. No telling how much crap +/* initial string that starts completion. No telling how much crap * the user has typed so far. Allocate LONG_STRING just to be sure! */ -static char User_typed [LONG_STRING] = {0}; +static char User_typed [LONG_STRING] = {0}; static int Num_matched = 0; /* Number of matches for completion */ static char Completed [STRING] = {0}; /* completed string (command or variable) */ @@ -2842,7 +2842,7 @@ static void matches_ensure_morespace(int current) if (current > Matches_listsize - 2) { - base_space = MAX(NUMVARS,NUMCOMMANDS) + 1; + base_space = MAX(NUMVARS,NUMCOMMANDS) + 1; extra_space = Matches_listsize - base_space; extra_space *= 2; space = base_space + extra_space; @@ -2920,7 +2920,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) snprintf(Completed, sizeof(Completed),"%s", Matches[0]); else if (numtabs > 1 && Num_matched > 2) /* cycle thru all the matches */ - snprintf(Completed, sizeof(Completed), "%s", + snprintf(Completed, sizeof(Completed), "%s", Matches[(numtabs - 2) % Num_matched]); /* return the completed command */ @@ -2932,7 +2932,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) || !mutt_strncmp (buffer, "toggle", 6)) { /* complete variables */ static const char * const prefixes[] = { "no", "inv", "?", "&", 0 }; - + pt++; /* loop through all the possible prefixes (no, inv, ...) */ if (!mutt_strncmp (buffer, "set", 3)) @@ -2946,7 +2946,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) } } } - + /* first TAB. Collect all the matches */ if (numtabs == 1) { @@ -2976,7 +2976,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) snprintf(Completed, sizeof(Completed),"%s", Matches[0]); else if (numtabs > 1 && Num_matched > 2) /* cycle thru all the matches */ - snprintf(Completed, sizeof(Completed), "%s", + snprintf(Completed, sizeof(Completed), "%s", Matches[(numtabs - 2) % Num_matched]); strncpy (pt, Completed, buffer + len - pt - spaces); @@ -2987,7 +2987,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) if (!menu && CurrentMenu != MENU_PAGER) menu = OpGeneric; - + pt++; /* first TAB. Collect all the matches */ if (numtabs == 1) @@ -2999,7 +2999,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) for (num = 0; menu[num].name; num++) candidate (Completed, User_typed, menu[num].name, sizeof (Completed)); /* try the generic menu */ - if (Completed[0] == 0 && CurrentMenu != MENU_PAGER) + if (Completed[0] == 0 && CurrentMenu != MENU_PAGER) { menu = OpGeneric; for (num = 0; menu[num].name; num++) @@ -3023,7 +3023,7 @@ int mutt_command_complete (char *buffer, size_t len, int pos, int numtabs) snprintf(Completed, sizeof(Completed),"%s", Matches[0]); else if (numtabs > 1 && Num_matched > 2) /* cycle thru all the matches */ - snprintf(Completed, sizeof(Completed), "%s", + snprintf(Completed, sizeof(Completed), "%s", Matches[(numtabs - 2) % Num_matched]); strncpy (pt, Completed, buffer + len - pt - spaces); @@ -3038,7 +3038,7 @@ int mutt_var_value_complete (char *buffer, size_t len, int pos) { char var[STRING], *pt = buffer; int spaces; - + if (buffer[0] == 0) return 0; @@ -3187,9 +3187,9 @@ static int var_to_string (int idx, char* val, size_t len) int mutt_query_variables (LIST *queries) { LIST *p; - + char command[STRING]; - + BUFFER err, token; mutt_buffer_init (&err); @@ -3197,7 +3197,7 @@ int mutt_query_variables (LIST *queries) err.dsize = STRING; err.data = safe_malloc (err.dsize); - + for (p = queries; p; p = p->next) { snprintf (command, sizeof (command), "set ?%s\n", p->data); @@ -3211,7 +3211,7 @@ int mutt_query_variables (LIST *queries) } printf ("%s\n", err.data); } - + FREE (&token.data); FREE (&err.data); @@ -3222,9 +3222,9 @@ int mutt_query_variables (LIST *queries) int mutt_dump_variables (void) { int i; - + char command[STRING]; - + BUFFER err, token; mutt_buffer_init (&err); @@ -3232,7 +3232,7 @@ int mutt_dump_variables (void) err.dsize = STRING; err.data = safe_malloc (err.dsize); - + for (i = 0; MuttVars[i].option; i++) { if (MuttVars[i].type == DT_SYN) @@ -3249,7 +3249,7 @@ int mutt_dump_variables (void) } printf("%s\n", err.data); } - + FREE (&token.data); FREE (&err.data); @@ -3399,12 +3399,12 @@ void mutt_init (int skip_sys_rc, LIST *commands) /* reverse alias keys need to be strdup'ed because of idna conversions */ ReverseAlias = hash_create (1031, MUTT_HASH_STRCASECMP | MUTT_HASH_STRDUP_KEYS | MUTT_HASH_ALLOW_DUPS); - + mutt_menu_init (); mutt_srandom (); mutt_buffer_pool_init (); - /* + /* * XXX - use something even more difficult to predict? */ snprintf (AttachmentMarker, sizeof (AttachmentMarker), @@ -3430,7 +3430,7 @@ void mutt_init (int skip_sys_rc, LIST *commands) Shell = safe_strdup (pw->pw_shell); endpwent (); } - else + else { if (!Homedir) { @@ -3555,12 +3555,12 @@ void mutt_init (int skip_sys_rc, LIST *commands) if ((p = getenv ("EMAIL")) != NULL) From = rfc822_parse_adrlist (NULL, p); - + mutt_set_langinfo_charset (); mutt_set_charset (Charset); - + Matches = safe_calloc (Matches_listsize, sizeof (char *)); - + /* Set standard defaults */ for (i = 0; MuttVars[i].option; i++) { @@ -3694,27 +3694,27 @@ static int parse_group_context (group_context_t **ctx, BUFFER *buf, BUFFER *s, u { while (!mutt_strcasecmp (buf->data, "-group")) { - if (!MoreArgs (s)) + if (!MoreArgs (s)) { strfcpy (err->data, _("-group: no group name"), err->dsize); goto bail; } - + mutt_extract_token (buf, s, 0); mutt_group_context_add (ctx, mutt_pattern_group (buf->data)); - + if (!MoreArgs (s)) { strfcpy (err->data, _("out of arguments"), err->dsize); goto bail; } - + mutt_extract_token (buf, s, 0); } - + return 0; - + bail: mutt_group_context_destroy (ctx); return -1; @@ -3730,10 +3730,10 @@ static void myvar_set (const char* var, const char* val) if (!*cur) *cur = safe_calloc (1, sizeof (myvar_t)); - + if (!(*cur)->name) (*cur)->name = safe_strdup (var); - + mutt_str_replace (&(*cur)->value, val); } @@ -3741,13 +3741,13 @@ static void myvar_del (const char* var) { myvar_t **cur; myvar_t *tmp; - + for (cur = &MyVars; *cur; cur = &((*cur)->next)) if (!mutt_strcmp ((*cur)->name, var)) break; - - if (*cur) + + if (*cur) { tmp = (*cur)->next; FREE (&(*cur)->name); @@ -3811,7 +3811,7 @@ int mutt_label_complete (char *buffer, size_t len, int numtabs) snprintf(Completed, sizeof(Completed), "%s", Matches[0]); else if (numtabs > 1 && Num_matched > 2) /* cycle thru all the matches */ - snprintf(Completed, sizeof(Completed), "%s", + snprintf(Completed, sizeof(Completed), "%s", Matches[(numtabs - 2) % Num_matched]); /* return the completed label */ @@ -3819,4 +3819,3 @@ int mutt_label_complete (char *buffer, size_t len, int numtabs) return 1; } - diff --git a/intl/bindtextdom.c b/intl/bindtextdom.c index 3047d6fc..152d3102 100644 --- a/intl/bindtextdom.c +++ b/intl/bindtextdom.c @@ -85,7 +85,7 @@ __libc_rwlock_define (extern, _nl_state_lock) static void set_binding_values PARAMS ((const char *domainname, const char **dirnamep, const char **codesetp)); - + /* Specifies the directory name *DIRNAMEP and the output codeset *CODESETP to be used for the DOMAINNAME message catalog. If *DIRNAMEP or *CODESETP is NULL, the corresponding attribute is not diff --git a/keymap.c b/keymap.c index dbc847d8..ec86a496 100644 --- a/keymap.c +++ b/keymap.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002,2010-2011 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -58,7 +58,7 @@ const struct mapping_t Menus[] = { #ifdef MIXMASTER { "mix", MENU_MIX }, #endif - + { "query", MENU_QUERY }, { "generic", MENU_GENERIC }, @@ -91,7 +91,7 @@ static struct mapping_t KeyNames[] = { #endif #ifdef KEY_NEXT { "", KEY_NEXT }, -#endif +#endif #ifdef NCURSES_VERSION /* extensions supported by ncurses. values are filled in during initialization */ @@ -192,14 +192,14 @@ static int parsekeys (const char *str, keycode_t *d, int max) strfcpy(buff, str, sizeof(buff)); s = buff; - + while (*s && len) { *d = '\0'; if(*s == '<' && (t = strchr(s, '>'))) { t++; c = *t; *t = '\0'; - + if ((n = mutt_getvaluebyname (s, KeyNames)) != -1) { s = t; @@ -215,7 +215,7 @@ static int parsekeys (const char *str, keycode_t *d, int max) s = t; *d = n; } - + *t = c; } @@ -307,7 +307,7 @@ static int get_op (const struct binding_t *bindings, const char *start, size_t l for (i = 0; bindings[i].name; i++) { - if (!ascii_strncasecmp (start, bindings[i].name, len) && + if (!ascii_strncasecmp (start, bindings[i].name, len) && mutt_strlen (bindings[i].name) == len) return bindings[i].op; } @@ -497,7 +497,7 @@ int km_dokey (int menu) if (menu != MENU_EDITOR && menu != MENU_PAGER) { /* check generic menu */ - bindings = OpGeneric; + bindings = OpGeneric; if ((func = get_func (bindings, tmp.op))) return tmp.op; } @@ -753,15 +753,15 @@ void km_init (void) #ifdef MIXMASTER create_bindings (OpMix, MENU_MIX); - + km_bindkey ("", MENU_MIX, OP_GENERIC_SELECT_ENTRY); km_bindkey ("h", MENU_MIX, OP_MIX_CHAIN_PREV); km_bindkey ("l", MENU_MIX, OP_MIX_CHAIN_NEXT); #endif - + /* bindings for the line editor */ create_bindings (OpEditor, MENU_EDITOR); - + km_bindkey ("", MENU_EDITOR, OP_EDITOR_HISTORY_UP); km_bindkey ("", MENU_EDITOR, OP_EDITOR_HISTORY_DOWN); km_bindkey ("", MENU_EDITOR, OP_EDITOR_BACKWARD_CHAR); @@ -771,10 +771,10 @@ void km_init (void) km_bindkey ("", MENU_EDITOR, OP_EDITOR_BACKSPACE); km_bindkey ("", MENU_EDITOR, OP_EDITOR_BACKSPACE); km_bindkey ("\177", MENU_EDITOR, OP_EDITOR_BACKSPACE); - + /* generic menu keymap */ create_bindings (OpGeneric, MENU_GENERIC); - + km_bindkey ("", MENU_GENERIC, OP_FIRST_ENTRY); km_bindkey ("", MENU_GENERIC, OP_LAST_ENTRY); km_bindkey ("", MENU_GENERIC, OP_NEXT_PAGE); @@ -796,7 +796,7 @@ void km_init (void) km_bindkey ("", MENU_GENERIC, OP_GENERIC_SELECT_ENTRY); /* Miscellaneous extra bindings */ - + km_bindkey (" ", MENU_MAIN, OP_DISPLAY_MESSAGE); km_bindkey ("", MENU_MAIN, OP_MAIN_PREV_UNDELETED); km_bindkey ("", MENU_MAIN, OP_MAIN_NEXT_UNDELETED); @@ -828,7 +828,7 @@ void km_init (void) km_bindkey ("9", MENU_PAGER, OP_JUMP); km_bindkey ("", MENU_PAGER, OP_NEXT_LINE); - + km_bindkey ("", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY); km_bindkey ("", MENU_ALIAS, OP_GENERIC_SELECT_ENTRY); km_bindkey ("", MENU_ALIAS, OP_TAG); @@ -966,7 +966,7 @@ static int try_bind (char *key, int menu, char *func, const struct binding_t *bindings) { int i; - + for (i = 0; bindings[i].name; i++) if (mutt_strcmp (func, bindings[i].name) == 0) { @@ -1122,7 +1122,7 @@ int mutt_parse_macro (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) /* exec function-name */ int mutt_parse_exec (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) { - int ops[128]; + int ops[128]; int nops = 0; const struct binding_t *bindings = NULL; char *function; @@ -1138,7 +1138,7 @@ int mutt_parse_exec (BUFFER *buf, BUFFER *s, unsigned long data, BUFFER *err) mutt_extract_token (buf, s, 0); function = buf->data; - if ((bindings = km_get_table (CurrentMenu)) == NULL + if ((bindings = km_get_table (CurrentMenu)) == NULL && CurrentMenu != MENU_PAGER) bindings = OpGeneric; diff --git a/keymap.h b/keymap.h index 3994861b..0f11a984 100644 --- a/keymap.h +++ b/keymap.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2002,2010 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef KEYMAP_H #define KEYMAP_H @@ -64,7 +64,7 @@ enum MENU_POST, MENU_QUERY, - + MENU_PGP, MENU_SMIME, @@ -72,7 +72,7 @@ enum MENU_KEY_SELECT_PGP, MENU_KEY_SELECT_SMIME, #endif - + #ifdef MIXMASTER MENU_MIX, #endif diff --git a/lib.c b/lib.c index 345d3be1..01dcd51a 100644 --- a/lib.c +++ b/lib.c @@ -1,24 +1,24 @@ /* * Copyright (C) 1996-2000,2007,2010 Michael R. Elkins * Copyright (C) 1999-2004,2006-2007 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ /* * This file used to contain some more functions, namely those @@ -57,8 +57,8 @@ static const struct sysexits { int v; const char *str; -} -sysexits_h[] = +} +sysexits_h[] = { #ifdef EX_USAGE { 0xff & EX_USAGE, "Bad usage." }, @@ -132,7 +132,7 @@ void *safe_calloc (size_t nmemb, size_t size) sleep (1); mutt_exit (1); } - + if (!(p = calloc (nmemb, size))) { mutt_error _("Out of memory!"); @@ -203,10 +203,10 @@ void safe_free (void *ptr) /* __SAFE_FREE_CHECKED__ */ int safe_fclose (FILE **f) { int r = 0; - + if (*f) r = fclose (*f); - + *f = NULL; return r; } @@ -246,18 +246,18 @@ char *safe_strcat (char *d, size_t l, const char *s) { char *p = d; - if (!l) + if (!l) return d; l--; /* Space for the trailing '\0'. */ - + for (; *d && l; l--) d++; for (; *s && l; l--) *d++ = *s++; *d = '\0'; - + return p; } @@ -267,16 +267,16 @@ char *safe_strncat (char *d, size_t l, const char *s, size_t sl) if (!l) return d; - + l--; /* Space for the trailing '\0'. */ - + for (; *d && l; l--) d++; for (; *s && l && sl; l--, sl--) *d++ = *s++; *d = '\0'; - + return p; } @@ -316,25 +316,25 @@ void mutt_unlink (const char *s) char buf[2048]; /* Defend against symlink attacks */ - -#ifdef O_NOFOLLOW + +#ifdef O_NOFOLLOW flags = O_RDWR | O_NOFOLLOW; #else flags = O_RDWR; #endif - + if (lstat (s, &sb) == 0 && S_ISREG(sb.st_mode)) { if ((fd = open (s, flags)) < 0) return; - - if ((fstat (fd, &sb2) != 0) || !S_ISREG (sb2.st_mode) + + if ((fstat (fd, &sb2) != 0) || !S_ISREG (sb2.st_mode) || (sb.st_dev != sb2.st_dev) || (sb.st_ino != sb2.st_ino)) { close (fd); return; } - + if ((f = fdopen (fd, "r+"))) { unlink (s); @@ -384,7 +384,7 @@ int mutt_copy_stream (FILE *fin, FILE *fout) return 0; } -int +int compare_stat (struct stat *osb, struct stat *nsb) { if (osb->st_dev != nsb->st_dev || osb->st_ino != nsb->st_ino || @@ -402,10 +402,10 @@ int safe_symlink(const char *oldpath, const char *newpath) if(!oldpath || !newpath) return -1; - + if(unlink(newpath) == -1 && errno != ENOENT) return -1; - + if (oldpath[0] == '/') { if (symlink (oldpath, newpath) == -1) @@ -418,7 +418,7 @@ int safe_symlink(const char *oldpath, const char *newpath) if ((getcwd (abs_oldpath, sizeof abs_oldpath) == NULL) || (strlen (abs_oldpath) + 1 + strlen (oldpath) + 1 > sizeof abs_oldpath)) return -1; - + strcat (abs_oldpath, "/"); /* __STRCAT_CHECKED__ */ strcat (abs_oldpath, oldpath); /* __STRCAT_CHECKED__ */ if (symlink (abs_oldpath, newpath) == -1) @@ -431,15 +431,15 @@ int safe_symlink(const char *oldpath, const char *newpath) unlink(newpath); return -1; } - + return 0; } -/* +/* * This function is supposed to do nfs-safe renaming of files. - * + * * Warning: We don't check whether src and target are equal. */ @@ -481,15 +481,15 @@ int safe_rename (const char *src, const char *target) /* * Coda does not allow cross-directory links, but tells * us it's a cross-filesystem linking attempt. - * + * * However, the Coda rename call is allegedly safe to use. - * - * With other file systems, rename should just fail when + * + * With other file systems, rename should just fail when * the files reside on different file systems, so it's safe * to try it here. * */ - + dprint (1, (debugfile, "safe_rename: link (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno)); /* @@ -506,13 +506,13 @@ int safe_rename (const char *src, const char *target) ) { dprint (1, (debugfile, "safe_rename: trying rename...\n")); - if (rename (src, target) == -1) + if (rename (src, target) == -1) { dprint (1, (debugfile, "safe_rename: rename (%s, %s) failed: %s (%d)\n", src, target, strerror (errno), errno)); return -1; } dprint (1, (debugfile, "safe_rename: rename succeeded.\n")); - + return 0; } @@ -544,7 +544,7 @@ int safe_rename (const char *src, const char *target) return -1; } - /* + /* * pretend that the link failed because the target file * did already exist. */ @@ -561,12 +561,12 @@ success: * Unlink the original link. Should we really ignore the return * value here? XXX */ - if (unlink (src) == -1) + if (unlink (src) == -1) { dprint (1, (debugfile, "safe_rename: unlink (%s) failed: %s (%d)\n", src, strerror (errno), errno)); } - + return 0; } @@ -574,7 +574,7 @@ success: /* Create a temporary directory next to a file name */ -static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, +static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, char *newdir, size_t ndlen) { const char *basename; @@ -582,7 +582,7 @@ static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, char *p; strfcpy (parent, NONULL (path), sizeof (parent)); - + if ((p = strrchr (parent, '/'))) { *p = '\0'; @@ -600,14 +600,14 @@ static int mutt_mkwrapdir (const char *path, char *newfile, size_t nflen, dprint(1, (debugfile, "mutt_mkwrapdir: mkdtemp() failed\n")); return -1; } - + if (snprintf (newfile, nflen, "%s/%s", newdir, NONULL(basename)) >= nflen) { rmdir(newdir); dprint(1, (debugfile, "mutt_mkwrapdir: string was truncated\n")); return -1; } - return 0; + return 0; } /* remove a directory and everything under it */ @@ -653,7 +653,7 @@ int mutt_rmtree (const char* path) static int mutt_put_file_in_place (const char *path, const char *safe_file, const char *safe_dir) { int rv; - + rv = safe_rename (safe_file, path); unlink (safe_file); rmdir (safe_dir); @@ -665,7 +665,7 @@ int safe_open (const char *path, int flags) struct stat osb, nsb; int fd; - if (flags & O_EXCL) + if (flags & O_EXCL) { char safe_file[_POSIX_PATH_MAX]; char safe_dir[_POSIX_PATH_MAX]; @@ -673,7 +673,7 @@ int safe_open (const char *path, int flags) if (mutt_mkwrapdir (path, safe_file, sizeof (safe_file), safe_dir, sizeof (safe_dir)) == -1) return -1; - + if ((fd = open (safe_file, flags, 0600)) < 0) { rmdir (safe_dir); @@ -688,7 +688,7 @@ int safe_open (const char *path, int flags) if ((fd = open (path, flags & ~O_EXCL, 0600)) < 0) return fd; - + /* make sure the file is not symlink */ if (lstat (path, &osb) < 0 || fstat (fd, &nsb) < 0 || compare_stat(&osb, &nsb) == -1) @@ -757,9 +757,9 @@ int mutt_rx_sanitize_string (char *dest, size_t destlen, const char *src) } *dest++ = *src++; } - + *dest = '\0'; - + if (*src) return -1; else @@ -866,7 +866,7 @@ size_t mutt_quote_filename (char *d, size_t l, const char *f) { size_t i, j = 0; - if(!f) + if(!f) { *d = '\0'; return 0; @@ -874,9 +874,9 @@ size_t mutt_quote_filename (char *d, size_t l, const char *f) /* leave some space for the trailing characters. */ l -= 6; - + d[j++] = '\''; - + for(i = 0; j < l && f[i]; i++) { if(f[i] == '\'' || f[i] == '`') @@ -889,10 +889,10 @@ size_t mutt_quote_filename (char *d, size_t l, const char *f) else d[j++] = f[i]; } - + d[j++] = '\''; d[j] = '\0'; - + return j; } @@ -960,7 +960,7 @@ char *mutt_skip_whitespace (char *p) void mutt_remove_trailing_ws (char *s) { char *p; - + for (p = s + mutt_strlen (s) - 1 ; p >= s && ISSPACE (*p) ; p--) *p = 0; } @@ -1011,10 +1011,10 @@ char *mutt_concatn_path (char *dst, size_t dstlen, char *mutt_concat_path (char *d, const char *dir, const char *fname, size_t l) { const char *fmt = "%s/%s"; - + if (!*fname || (*dir && dir[strlen(dir)-1] == '/')) fmt = "%s%s"; - + snprintf (d, l, fmt, dir, fname); return d; } @@ -1032,13 +1032,13 @@ const char * mutt_strsysexit(int e) { int i; - + for(i = 0; sysexits_h[i].str; i++) { if(e == sysexits_h[i].v) break; } - + return sysexits_h[i].str; } diff --git a/lib.h b/lib.h index eec531b6..81453b30 100644 --- a/lib.h +++ b/lib.h @@ -1,24 +1,24 @@ /* * Copyright (C) 1996-2000,2007,2010,2012 Michael R. Elkins * Copyright (C) 1999-2005,2007 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ /* mutt functions which are generally useful. */ @@ -65,7 +65,7 @@ /* * Create a format string to be used with scanf. * To use it, write, for instance, MUTT_FORMAT(HUGE_STRING). - * + * * See K&R 2nd ed, p. 231 for an explanation. */ # define _MUTT_FORMAT_2(a,b) "%" a b @@ -133,7 +133,7 @@ extern void (*mutt_error) (const char *, ...); # endif # ifdef _LIB_C -# define MUTT_LIB_WHERE +# define MUTT_LIB_WHERE # define MUTT_LIB_INITVAL(x) = x # else # define MUTT_LIB_WHERE extern diff --git a/mailbox.h b/mailbox.h index 602850ed..47d7c091 100644 --- a/mailbox.h +++ b/mailbox.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _MAILBOX_H #define _MAILBOX_H diff --git a/main.c b/main.c index 347521ea..ed03a75b 100644 --- a/main.c +++ b/main.c @@ -2,21 +2,21 @@ * Copyright (C) 1996-2007,2010,2013 Michael R. Elkins * Copyright (C) 1999-2007 Thomas Roessler * Copyright (C) 2004 g10 Code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #define MAIN_C 1 @@ -154,7 +154,7 @@ options:\n\ -m \tspecify a default mailbox type\n\ -n\t\tcauses Mutt not to read the system Muttrc\n\ -p\t\trecall a postponed message"); - + puts _("\ -Q \tquery a configuration variable\n\ -R\t\topen mailbox in read-only mode\n\ @@ -218,7 +218,7 @@ static void show_version (void) #endif #ifdef HAVE_LIBIDN - printf ("\nlibidn: %s (compiled with %s)", stringprep_check_version (NULL), + printf ("\nlibidn: %s (compiled with %s)", stringprep_check_version (NULL), STRINGPREP_VERSION); #endif @@ -254,9 +254,9 @@ static void show_version (void) #else puts ("-DEBUG"); #endif - - + + puts ( #ifdef HOMESPOOL @@ -314,7 +314,7 @@ static void show_version (void) "-USE_SMTP " #endif "\n" - + #ifdef USE_SSL_OPENSSL "+USE_SSL_OPENSSL " #else @@ -344,7 +344,7 @@ static void show_version (void) "-HAVE_GETADDRINFO " #endif ); - + puts ( #ifdef HAVE_REGCOMP "+HAVE_REGCOMP " @@ -359,25 +359,25 @@ static void show_version (void) #endif "\n" - + #ifdef HAVE_COLOR "+HAVE_COLOR " #else "-HAVE_COLOR " #endif - + #ifdef HAVE_START_COLOR "+HAVE_START_COLOR " #else "-HAVE_START_COLOR " #endif - + #ifdef HAVE_TYPEAHEAD "+HAVE_TYPEAHEAD " #else "-HAVE_TYPEAHEAD " #endif - + #ifdef HAVE_BKGDSET "+HAVE_BKGDSET " #else @@ -385,32 +385,32 @@ static void show_version (void) #endif "\n" - + #ifdef HAVE_CURS_SET "+HAVE_CURS_SET " #else "-HAVE_CURS_SET " #endif - + #ifdef HAVE_META "+HAVE_META " #else "-HAVE_META " #endif - + #ifdef HAVE_RESIZETERM "+HAVE_RESIZETERM " #else "-HAVE_RESIZETERM " #endif - + #ifdef HAVE_FUTIMENS "+HAVE_FUTIMENS " #else "-HAVE_FUTIMENS " #endif - ); - + ); + puts ( #ifdef CRYPT_BACKEND_CLASSIC_PGP "+CRYPT_BACKEND_CLASSIC_PGP " @@ -428,7 +428,7 @@ static void show_version (void) "-CRYPT_BACKEND_GPGME " #endif ); - + puts ( #ifdef EXACT_ADDRESS "+EXACT_ADDRESS " @@ -443,7 +443,7 @@ static void show_version (void) #endif "\n" - + #ifdef ENABLE_NLS "+ENABLE_NLS " #else @@ -455,26 +455,26 @@ static void show_version (void) #else "-LOCALES_HACK " #endif - + #ifdef HAVE_WC_FUNCS "+HAVE_WC_FUNCS " #else "-HAVE_WC_FUNCS " #endif - + #ifdef HAVE_LANGINFO_CODESET "+HAVE_LANGINFO_CODESET " #else "-HAVE_LANGINFO_CODESET " #endif - + #ifdef HAVE_LANGINFO_YESEXPR "+HAVE_LANGINFO_YESEXPR " #else "-HAVE_LANGINFO_YESEXPR " #endif - + "\n" #if HAVE_ICONV @@ -557,7 +557,7 @@ static void show_version (void) puts(_(ReachingUs)); mutt_print_patchlist(); - + exit (0); } @@ -632,7 +632,7 @@ int main (int argc, char **argv, char **environ) const char *exit_endwin_msg = NULL; /* sanity check against stupid administrators */ - + if(getegid() != getgid()) { fprintf(stderr, "%s: I don't want to run with privileges!\n", @@ -676,7 +676,7 @@ int main (int argc, char **argv, char **environ) for (optind = 1; optind < double_dash; ) { /* We're getopt'ing POSIXLY, so we'll be here every time getopt() - * encounters a non-option. That could be a file to attach + * encounters a non-option. That could be a file to attach * (all non-options between -a and --) or it could be an address * (which gets collapsed to the front of argv). */ @@ -762,7 +762,7 @@ int main (int argc, char **argv, char **environ) case 'm': /* should take precedence over .muttrc setting, so save it for later */ - newMagic = optarg; + newMagic = optarg; break; case 'n': @@ -776,7 +776,7 @@ int main (int argc, char **argv, char **environ) case 'Q': queries = mutt_add_list (queries, optarg); break; - + case 'R': flags |= MUTT_RO; /* read-only mode */ break; @@ -951,7 +951,7 @@ int main (int argc, char **argv, char **environ) char *bodytext = NULL, *bodyfile = NULL; int rv = 0; char expanded_infile[_POSIX_PATH_MAX]; - + if (!option (OPTNOCURSES)) mutt_flushinp (); diff --git a/mapping.h b/mapping.h index 760c33a8..0a3a6fdc 100644 --- a/mapping.h +++ b/mapping.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef MAPPING_H #define MAPPING_H diff --git a/mbox.c b/mbox.c index 254db452..6793d8e2 100644 --- a/mbox.c +++ b/mbox.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* This file contains code to parse ``mbox'' and ``mmdf'' style mailboxes */ @@ -64,7 +64,7 @@ int mbox_lock_mailbox (CONTEXT *ctx, int excl, int retry) ctx->readonly = 1; return 0; } - + return (r); } @@ -169,7 +169,7 @@ int mmdf_parse_mailbox (CONTEXT *ctx) mutt_error _("Mailbox is corrupt!"); return (-1); } - } + } else hdr->received = t - mutt_local_tz (t); @@ -322,12 +322,12 @@ int mbox_parse_mailbox (CONTEXT *ctx) if (ctx->msgcount == ctx->hdrmax) mx_alloc_memory (ctx); - + curhdr = ctx->hdrs[ctx->msgcount] = mutt_new_header (); curhdr->received = t - mutt_local_tz (t); curhdr->offset = loc; curhdr->index = ctx->msgcount; - + curhdr->env = mutt_read_rfc822_header (ctx->fp, curhdr, 0, 0); /* if we know how long this message is, either just skip over the body, @@ -409,10 +409,10 @@ int mbox_parse_mailbox (CONTEXT *ctx) } else lines++; - + loc = ftello (ctx->fp); } - + /* * Only set the content-length of the previous message if we have read more * than one message during _this_ invocation. If this routine is called @@ -718,7 +718,7 @@ static int mbox_check_mailbox (CONTEXT *ctx, int *index_hint) } /* - * Check to make sure that the only change to the mailbox is that + * Check to make sure that the only change to the mailbox is that * message(s) were appended to this file. My heuristic is that we should * see the message separator at *exactly* what used to be the end of the * folder. @@ -905,11 +905,11 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) /* find the first deleted/changed message. we save a lot of time by only * rewriting the mailbox from the point where it has actually changed. */ - for (i = 0 ; i < ctx->msgcount && !ctx->hdrs[i]->deleted && + for (i = 0 ; i < ctx->msgcount && !ctx->hdrs[i]->deleted && !ctx->hdrs[i]->changed && !ctx->hdrs[i]->attach_del; i++) ; if (i == ctx->msgcount) - { + { /* this means ctx->changed or ctx->deleted was set, but no * messages were found to be changed or deleted. This should * never happen, is we presume it is a bug in mutt. @@ -922,16 +922,16 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) } /* save the index of the first changed/deleted message */ - first = i; + first = i; /* where to start overwriting */ - offset = ctx->hdrs[i]->offset; + offset = ctx->hdrs[i]->offset; /* the offset stored in the header does not include the MMDF_SEP, so make * sure we seek to the correct location */ if (ctx->magic == MUTT_MMDF) offset -= (sizeof MMDF_SEP - 1); - + /* allocate space for the new offsets */ newOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t)); oldOffset = safe_calloc (ctx->msgcount - first, sizeof (struct m_update_t)); @@ -950,7 +950,7 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) * back up some information which is needed to restore offsets when * something fails. */ - + oldOffset[i-first].valid = 1; oldOffset[i-first].hdr = ctx->hdrs[i]->offset; oldOffset[i-first].body = ctx->hdrs[i]->content->offset; @@ -970,7 +970,7 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) unlink (tempfile); goto bail; } - + } /* save the new offset for this message. we add `offset' because the @@ -999,17 +999,17 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) switch(ctx->magic) { - case MUTT_MMDF: - if(fputs(MMDF_SEP, fp) == EOF) + case MUTT_MMDF: + if(fputs(MMDF_SEP, fp) == EOF) { mutt_perror (tempfile); mutt_sleep (5); unlink (tempfile); - goto bail; + goto bail; } break; default: - if(fputs("\n", fp) == EOF) + if(fputs("\n", fp) == EOF) { mutt_perror (tempfile); mutt_sleep (5); @@ -1019,7 +1019,7 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) } } } - + if (fclose (fp) != 0) { fp = NULL; @@ -1099,9 +1099,9 @@ static int mbox_sync_mailbox (CONTEXT *ctx, int *index_hint) /* error occurred while writing the mailbox back, so keep the temp copy * around */ - + char savefile[_POSIX_PATH_MAX]; - + snprintf (savefile, sizeof (savefile), "%s/mutt.%s-%s-%u", NONULL (Tempdir), NONULL(Username), NONULL(Hostname), (unsigned int)getpid ()); rename (tempfile, savefile); @@ -1167,7 +1167,7 @@ bail: /* Come here in case of disaster */ ctx->hdrs[i]->content->length = oldOffset[i-first].length; } } - + /* this is ok to call even if we haven't locked anything */ mbox_unlock_mailbox (ctx); @@ -1202,10 +1202,10 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) /* silent operations */ ctx->quiet = 1; - + if (!ctx->quiet) mutt_message _("Reopening mailbox..."); - + /* our heuristics require the old mailbox to be unsorted */ if (Sort != SORT_ORDER) { @@ -1219,7 +1219,7 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) old_hdrs = NULL; old_msgcount = 0; - + /* simulate a close */ if (ctx->id_hash) hash_destroy (&ctx->id_hash, NULL); @@ -1273,7 +1273,7 @@ int mutt_reopen_mailbox (CONTEXT *ctx, int *index_hint) rc = -1; break; } - + if (rc == -1) { /* free the old headers */ diff --git a/mbyte.c b/mbyte.c index b4df70a6..6556d24d 100644 --- a/mbyte.c +++ b/mbyte.c @@ -574,4 +574,3 @@ int mutt_filter_unprintable (char **s) FREE (&b); return 0; } - diff --git a/menu.c b/menu.c index b9031935..86f4a870 100644 --- a/menu.c +++ b/menu.c @@ -177,9 +177,9 @@ static void print_enriched_string (int attr, unsigned char *s, int do_color) } } -static void menu_make_entry (char *s, int l, MUTTMENU *menu, int i) +static void menu_make_entry (char *s, int l, MUTTMENU *menu, int i) { - if (menu->dialog) + if (menu->dialog) { strncpy (s, menu->dialog[i], l); menu->current = -1; /* hide menubar */ @@ -299,7 +299,7 @@ void menu_redraw_motion (MUTTMENU *menu) char buf[LONG_STRING]; int old_color, cur_color; - if (menu->dialog) + if (menu->dialog) { menu->redraw &= ~REDRAW_MOTION; return; @@ -375,9 +375,9 @@ void menu_redraw_current (MUTTMENU *menu) static void menu_redraw_prompt (MUTTMENU *menu) { - if (menu->dialog) + if (menu->dialog) { - if (option (OPTMSGERR)) + if (option (OPTMSGERR)) { mutt_sleep (1); unset_option (OPTMSGERR); @@ -398,13 +398,13 @@ void menu_check_recenter (MUTTMENU *menu) if (!option (OPTMENUMOVEOFF) && menu->max <= menu->pagelen) /* less entries than lines */ { - if (menu->top != 0) + if (menu->top != 0) { menu->top = 0; menu->redraw |= REDRAW_INDEX; } } - else + else { if (option (OPTMENUSCROLL) || (menu->pagelen <= 0) || (c < MenuContext)) { @@ -418,7 +418,7 @@ void menu_check_recenter (MUTTMENU *menu) if (menu->current < menu->top + c) menu->top -= (menu->pagelen - c) * ((menu->top + menu->pagelen - 1 - menu->current) / (menu->pagelen - c)) - c; else if ((menu->current >= menu->top + menu->pagelen - c)) - menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; + menu->top += (menu->pagelen - c) * ((menu->current - menu->top) / (menu->pagelen - c)) - c; } } @@ -491,7 +491,7 @@ void menu_prev_line (MUTTMENU *menu) mutt_error _("You cannot scroll up farther."); } -/* +/* * pageup: jumplen == -pagelen * pagedown: jumplen == pagelen * halfup: jumplen == -pagelen/2 @@ -897,18 +897,18 @@ static int menu_dialog_translate_op (int i) { switch (i) { - case OP_NEXT_ENTRY: + case OP_NEXT_ENTRY: return OP_NEXT_LINE; - case OP_PREV_ENTRY: + case OP_PREV_ENTRY: return OP_PREV_LINE; - case OP_CURRENT_TOP: case OP_FIRST_ENTRY: + case OP_CURRENT_TOP: case OP_FIRST_ENTRY: return OP_TOP_PAGE; - case OP_CURRENT_BOTTOM: case OP_LAST_ENTRY: + case OP_CURRENT_BOTTOM: case OP_LAST_ENTRY: return OP_BOTTOM_PAGE; - case OP_CURRENT_MIDDLE: - return OP_MIDDLE_PAGE; + case OP_CURRENT_MIDDLE: + return OP_MIDDLE_PAGE; } - + return i; } @@ -955,10 +955,10 @@ int menu_redraw (MUTTMENU *menu) /* allow the caller to do any local configuration */ return (OP_REDRAW); } - + if (!menu->dialog) menu_check_recenter (menu); - + if (menu->redraw & REDRAW_STATUS) menu_redraw_status (menu); #ifdef USE_SIDEBAR @@ -971,10 +971,10 @@ int menu_redraw (MUTTMENU *menu) menu_redraw_motion (menu); else if (menu->redraw == REDRAW_CURRENT) menu_redraw_current (menu); - + if (menu->dialog) menu_redraw_prompt (menu); - + return OP_NULL; } @@ -1079,7 +1079,7 @@ int mutt_menuLoop (MUTTMENU *menu) mutt_clear_error (); /* Convert menubar movement to scrolling */ - if (menu->dialog) + if (menu->dialog) i = menu_dialog_translate_op (i); switch (i) diff --git a/mh.c b/mh.c index 8d44f0fb..bf403114 100644 --- a/mh.c +++ b/mh.c @@ -2,17 +2,17 @@ * Copyright (C) 1996-2002,2007,2009 Michael R. Elkins * Copyright (C) 1999-2005 Thomas Roessler * Copyright (C) 2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -693,7 +693,7 @@ static void maildir_parse_flags (HEADER * h, const char *path) if ((p = strrchr (path, ':')) != NULL && mutt_strncmp (p + 1, "2,", 2) == 0) { p += 3; - + mutt_str_replace (&h->maildir_flags, p); q = h->maildir_flags; @@ -723,7 +723,7 @@ static void maildir_parse_flags (HEADER * h, const char *path) h->deleted = 1; } break; - + default: *q++ = *p; break; @@ -731,7 +731,7 @@ static void maildir_parse_flags (HEADER * h, const char *path) p++; } } - + if (q == h->maildir_flags) FREE (&h->maildir_flags); else if (q) @@ -768,7 +768,7 @@ static void maildir_update_mtime (CONTEXT * ctx) mutt_buffer_pool_release (&buf); } -/* +/* * Actually parse a maildir message. This may also be used to fill * out a fake header structure generated by lazy maildir parsing. */ @@ -798,9 +798,9 @@ static HEADER *maildir_parse_message (int magic, const char *fname, if (magic == MUTT_MAILDIR) { - /* + /* * maildir stores its flags in the filename, so ignore the - * flags in the header of the message + * flags in the header of the message */ h->old = is_old; @@ -981,37 +981,37 @@ static struct maildir* maildir_merge_lists (struct maildir *left, struct maildir* head; struct maildir* tail; - if (left && right) + if (left && right) { if (cmp (left, right) < 0) { head = left; left = left->next; } - else + else { head = right; right = right->next; } - } - else + } + else { - if (left) + if (left) return left; - else + else return right; } - + tail = head; - while (left && right) + while (left && right) { if (cmp (left, right) < 0) { tail->next = left; left = left->next; - } - else + } + else { tail->next = right; right = right->next; @@ -1019,7 +1019,7 @@ static struct maildir* maildir_merge_lists (struct maildir *left, tail = tail->next; } - if (left) + if (left) { tail->next = left; } @@ -1071,7 +1071,7 @@ static struct maildir* maildir_sort (struct maildir* list, size_t len, struct maildir* right = list; size_t c = 0; - if (!list || !list->next) + if (!list || !list->next) { return list; } @@ -1080,7 +1080,7 @@ static struct maildir* maildir_sort (struct maildir* list, size_t len, return maildir_ins_sort (list, cmp); list = list->next; - while (list && list->next) + while (list && list->next) { right = right->next; list = list->next->next; @@ -1129,12 +1129,12 @@ static struct maildir *skip_duplicates (struct maildir *p, struct maildir **last } #endif -/* +/* * This function does the second parsing pass */ static void maildir_delayed_parsing (CONTEXT * ctx, struct maildir **md, progress_t *progress) -{ +{ struct maildir *p, *last = NULL; BUFFER *fn = NULL; int count; @@ -1446,7 +1446,7 @@ static void maildir_flags (char *dest, size_t destlen, HEADER * hdr) * will end up in the cur directory, so we include it in the following * test even though there is no associated flag. */ - + if (hdr && (hdr->flagged || hdr->replied || hdr->read || hdr->deleted || hdr->old || hdr->maildir_flags)) { char tmp[LONG_STRING]; @@ -1506,7 +1506,7 @@ static int mh_close_message (CONTEXT *ctx, MESSAGE *msg) /* * Open a new (temporary) message in a maildir folder. - * + * * Note that this uses _almost_ the maildir file name format, but * with a {cur,new} prefix. * @@ -1587,23 +1587,23 @@ out: /* * Commit a message to a maildir folder. - * + * * msg->path contains the file name of a file in tmp/. We take the - * flags from this file's name. + * flags from this file's name. * * ctx is the mail folder we commit to. - * + * * hdr is a header structure to which we write the message's new * file name. This is used in the mh and maildir folder synch * routines. When this routine is invoked from mx_commit_message, - * hdr is NULL. + * hdr is NULL. * * msg->path looks like this: - * + * * tmp/{cur,new}.mutt-HOSTNAME-PID-COUNTER:flags - * + * * See also maildir_open_new_message(). - * + * */ static int _maildir_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr) @@ -1690,9 +1690,9 @@ static int maildir_commit_message (CONTEXT * ctx, MESSAGE * msg) return _maildir_commit_message (ctx, msg, NULL); } -/* +/* * commit a message to an MH folder. - * + * */ @@ -1741,9 +1741,9 @@ static int _mh_commit_message (CONTEXT * ctx, MESSAGE * msg, HEADER * hdr, } closedir (dirp); - /* + /* * Now try to rename the file to the proper name. - * + * * Note: We may have to try multiple times, until we find a free * slot. */ @@ -1786,7 +1786,7 @@ static int mh_commit_message (CONTEXT * ctx, MESSAGE * msg) /* Sync a message in an MH folder. - * + * * This code is also used for attachment deletion in maildir * folders. */ @@ -1831,7 +1831,7 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno) restore = 0; } - /* + /* * Try to move the new message to the old place. * (MH only.) * @@ -1840,7 +1840,7 @@ static int mh_rewrite_message (CONTEXT * ctx, int msgno) * Note that there is a race condition against programs which * use the first free slot instead of the maximum message * number. Mutt does _not_ behave like this. - * + * * Anyway, if this fails, the message is in the folder, so * all what happens is that a concurrently running mutt will * lose flag modifications. @@ -1987,9 +1987,9 @@ int mh_sync_mailbox (CONTEXT * ctx, int *index_hint) if (ctx->magic == MUTT_MH) i = mh_check_mailbox (ctx, index_hint); - else + else i = maildir_check_mailbox (ctx, index_hint); - + if (i != 0) return i; @@ -2129,7 +2129,7 @@ static void maildir_update_tables (CONTEXT *ctx, int *index_hint) short old_sort; int old_count; int i, j; - + if (Sort != SORT_ORDER) { old_sort = Sort; @@ -2137,13 +2137,13 @@ static void maildir_update_tables (CONTEXT *ctx, int *index_hint) mutt_sort_headers (ctx, 1); Sort = old_sort; } - + old_count = ctx->msgcount; for (i = 0, j = 0; i < old_count; i++) { if (ctx->hdrs[i]->active && index_hint && *index_hint == i) *index_hint = j; - + if (ctx->hdrs[i]->active) ctx->hdrs[i]->index = j++; } @@ -2159,7 +2159,7 @@ static int maildir_update_flags (CONTEXT *ctx, HEADER *o, HEADER *n) */ int context_changed = ctx->changed; int header_changed; - + /* user didn't modify this message. alter the flags to match the * current state on disk. This may not actually do * anything. mutt_set_flag() will just ignore the call if the status @@ -2181,7 +2181,7 @@ static int maildir_update_flags (CONTEXT *ctx, HEADER *o, HEADER *n) */ header_changed = o->changed; o->changed = 0; - + /* if the mailbox was not modified before we made these * changes, unset the changed flag since nothing needs to * be synchronized. @@ -2355,7 +2355,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint) /* If we didn't just get new mail, update the tables. */ if (occult) maildir_update_tables (ctx, index_hint); - + /* do any delayed parsing we need to do. */ maildir_delayed_parsing (ctx, &md, NULL); @@ -2373,7 +2373,7 @@ static int maildir_check_mailbox (CONTEXT * ctx, int *index_hint) return 0; } -/* +/* * This function handles arrival of new mail and reopening of * mh/maildir folders. Things are getting rather complex because we * don't have a well-defined "mailbox order", so the tricks from @@ -2407,14 +2407,14 @@ static int mh_check_mailbox (CONTEXT * ctx, int *index_hint) mutt_buffer_pool_release (&buf); return -1; } - + /* create .mh_sequences when there isn't one. */ mutt_buffer_printf (buf, "%s/.mh_sequences", ctx->path); if ((i = stat (mutt_b2s (buf), &st_cur)) == -1 && errno == ENOENT) { char *tmp; FILE *fp = NULL; - + if (mh_mkstemp (ctx, &fp, &tmp) == 0) { safe_fclose (&fp); @@ -2703,7 +2703,7 @@ int mh_check_empty (const char *path) DIR *dp; struct dirent *de; int r = 1; /* assume empty until we find a message */ - + if ((dp = opendir (path)) == NULL) return -1; while ((de = readdir (dp))) @@ -2715,7 +2715,7 @@ int mh_check_empty (const char *path) } } closedir (dp); - + return r; } diff --git a/mime.h b/mime.h index c1e441e4..379133d2 100644 --- a/mime.h +++ b/mime.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2010 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* Content-Type */ enum diff --git a/mutt.h b/mutt.h index be43d38d..8dcf0a81 100644 --- a/mutt.h +++ b/mutt.h @@ -1,24 +1,24 @@ /* * Copyright (C) 1996-2002,2010,2013 Michael R. Elkins * Copyright (C) 2004 g10 Code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef MUTT_H -#define MUTT_H +#define MUTT_H #include #include @@ -95,11 +95,11 @@ struct timespec /* nifty trick I stole from ELM 2.5alpha. */ #ifdef MAIN_C -#define WHERE +#define WHERE #define INITVAL(x) = x #else #define WHERE extern -#define INITVAL(x) +#define INITVAL(x) #endif #define WHERE_DEFINED 1 @@ -271,7 +271,7 @@ enum MUTT_XLABEL, MUTT_MIMEATTACH, MUTT_MIMETYPE, - + /* Options for Mailcap lookup */ MUTT_EDIT, MUTT_COMPOSE, @@ -328,7 +328,7 @@ enum #endif OPT_SUBJECT, OPT_VERIFYSIG, /* verify PGP signatures */ - + /* THIS MUST BE THE LAST VALUE. */ OPT_MAX }; @@ -533,7 +533,7 @@ enum OPTCRYPTUSEPKA, /* PGP options */ - + OPTCRYPTAUTOSIGN, OPTCRYPTAUTOENCRYPT, OPTCRYPTAUTOPGP, @@ -725,9 +725,9 @@ typedef struct body char *filename; /* when sending a message, this is the file * to which this structure refers */ - char *d_filename; /* filename to be used for the + char *d_filename; /* filename to be used for the * content-disposition header. - * If NULL, filename is used + * If NULL, filename is used * instead. */ char *charset; /* charset of attached file */ @@ -762,7 +762,7 @@ typedef struct body unsigned int deleted : 1; /* attachment marked for deletion */ unsigned int noconv : 1; /* don't do character set conversion */ - unsigned int force_charset : 1; + unsigned int force_charset : 1; /* send mode: don't adjust the character * set when in send-mode. */ @@ -816,7 +816,7 @@ typedef struct header * This flag is used by the maildir_trash * option. */ - + /* timezone of the sender of this message */ unsigned int zhours : 5; unsigned int zminutes : 6; @@ -835,7 +835,7 @@ typedef struct header size_t num_hidden; /* number of hidden messages in this view */ short recipient; /* user_is_recipient()'s return value, cached */ - + int pair; /* color-pair to use when displaying in the index */ time_t date_sent; /* time when the message was sent (UTC) */ @@ -849,7 +849,7 @@ typedef struct header ENVELOPE *env; /* envelope information */ BODY *content; /* list of MIME parts */ char *path; - + char *tree; /* character string to print thread tree */ THREAD *thread; @@ -867,7 +867,7 @@ typedef struct header #if defined USE_POP || defined USE_IMAP void *data; /* driver-specific data */ #endif - + char *maildir_flags; /* unknown maildir flags */ } HEADER; @@ -925,7 +925,7 @@ typedef struct pattern_t int max; struct pattern_t *next; struct pattern_t *child; /* arguments to logical op */ - union + union { regex_t *rx; group_t *g; diff --git a/mutt_crypt.h b/mutt_crypt.h index 2a368d1a..76ace465 100644 --- a/mutt_crypt.h +++ b/mutt_crypt.h @@ -1,21 +1,21 @@ /* * Copyright (C) 2003 Werner Koch * Copyright (C) 2004 g10code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* Common definitions and prototypes for the crypt functions. They are @@ -49,7 +49,7 @@ #define PGPENCRYPT (APPLICATION_PGP | ENCRYPT) #define PGPSIGN (APPLICATION_PGP | SIGN) #define PGPGOODSIGN (APPLICATION_PGP | GOODSIGN) -#define PGPKEY (APPLICATION_PGP | KEYBLOCK) +#define PGPKEY (APPLICATION_PGP | KEYBLOCK) #define PGPINLINE (APPLICATION_PGP | INLINE) #define SMIMEENCRYPT (APPLICATION_SMIME | ENCRYPT) @@ -135,9 +135,9 @@ void convert_to_7bit (BODY *); -/*-- crypt.c --*/ +/*-- crypt.c --*/ -/* Print the current time. */ +/* Print the current time. */ void crypt_current_time(STATE *s, char *app_name); /* Check out the type of encryption used and set the cached status @@ -148,7 +148,7 @@ int crypt_query (BODY *m); void crypt_extract_keys_from_messages (HEADER *h); /* Do a quick check to make sure that we can find all of the - encryption keys if the user has requested this service. + encryption keys if the user has requested this service. Return the list of keys in KEYLIST. If oppenc_mode is true, only keys that can be determined without prompting will be used. */ @@ -169,13 +169,13 @@ int crypt_valid_passphrase (int); int crypt_write_signed(BODY *a, STATE *s, const char *tempf); /* Obtain pointers to fingerprint or short or long key ID, if any. - + Upon return, at most one of return, *ppl and *pps pointers is non-NULL, indicating the longest fingerprint or ID found, if any. Return: Copy of fingerprint, if any, stripped of all spaces, else NULL. Must be FREE'd by caller. - *pphint Start of string to be passed to pgp_add_string_to_hints() or + *pphint Start of string to be passed to pgp_add_string_to_hints() or crypt_add_string_to_hints(). *ppl Start of long key ID if detected, else NULL. *pps Start of short key ID if detected, else NULL. */ diff --git a/mutt_curses.h b/mutt_curses.h index bd563f7b..8e88be76 100644 --- a/mutt_curses.h +++ b/mutt_curses.h @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2012 Michael R. Elkins * Copyright (C) 2004 g10 Code GmbH - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _MUTT_CURSES_H_ #define _MUTT_CURSES_H_ 1 diff --git a/mutt_idna.c b/mutt_idna.c index cb231b5a..d4b2d327 100644 --- a/mutt_idna.c +++ b/mutt_idna.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2003,2005,2008-2009 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" diff --git a/mutt_idna.h b/mutt_idna.h index 62e6e301..4bdd627f 100644 --- a/mutt_idna.h +++ b/mutt_idna.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2003,2005 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _MUTT_IDNA_H # define _MUTT_IDNA_H diff --git a/mutt_menu.h b/mutt_menu.h index b0de226f..5ae7de9d 100644 --- a/mutt_menu.h +++ b/mutt_menu.h @@ -58,18 +58,18 @@ typedef struct menu_t mutt_window_t *helpwin; mutt_window_t *messagewin; - /* Setting dialog != NULL overrides normal menu behavior. + /* Setting dialog != NULL overrides normal menu behavior. * In dialog mode menubar is hidden and prompt keys are checked before - * normal menu movement keys. This can cause problems with scrolling, if + * normal menu movement keys. This can cause problems with scrolling, if * prompt keys override movement keys. */ char **dialog; /* dialog lines themselves */ char *prompt; /* prompt for user, similar to mutt_multi_choice */ char *keys; /* keys used in the prompt */ - + /* callback to generate an index line for the requested element */ void (*make_entry) (char *, size_t, struct menu_t *, int); - + /* how to search the menu */ int (*search) (struct menu_t *, regex_t *re, int n); @@ -79,11 +79,11 @@ typedef struct menu_t void (*custom_menu_redraw) (struct menu_t *); void *redraw_data; - /* color pair to be used for the requested element + /* color pair to be used for the requested element * (default function returns ColorDefs[MT_COLOR_NORMAL]) */ int (*color) (int i); - + /* the following are used only by mutt_menuLoop() */ int top; /* entry that is the top of the current page */ int oldcurrent; /* for driver use only. */ diff --git a/mutt_regex.h b/mutt_regex.h index f10ecbe5..b145af90 100644 --- a/mutt_regex.h +++ b/mutt_regex.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * A (more) generic interface to regular expression matching diff --git a/mutt_sasl.c b/mutt_sasl.c index 16a026b6..3980cc41 100644 --- a/mutt_sasl.c +++ b/mutt_sasl.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2008,2012,2014 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* common SASL helper routines */ @@ -77,7 +77,7 @@ static int getnameinfo_err(int ret) /* arbitrary. SASL will probably use a smaller buffer anyway. OTOH it's * been a while since I've had access to an SASL server which negotiated - * a protection buffer. */ + * a protection buffer. */ #define MUTT_SASL_MAXBUF 65536 #define IP_PORT_BUFLEN 1024 @@ -207,7 +207,7 @@ int mutt_sasl_client_new (CONNECTION* conn, sasl_conn_t** saslconn) } else dprint (2, (debugfile, "SASL failed to get local IP address\n")); - + size = sizeof (remote); if (!getpeername (conn->fd, (struct sockaddr *)&remote, &size)){ if (iptostring((struct sockaddr *)&remote, size, ipremoteport, @@ -221,7 +221,7 @@ int mutt_sasl_client_new (CONNECTION* conn, sasl_conn_t** saslconn) dprint (2, (debugfile, "SASL local ip: %s, remote ip:%s\n", NONULL(plp), NONULL(prp))); - + rc = sasl_client_new (service, conn->account.host, plp, prp, mutt_sasl_get_callbacks (&conn->account), 0, saslconn); @@ -338,7 +338,7 @@ int mutt_sasl_interact (sasl_interact_t* interaction) * abstraction problem is that there is more in CONNECTION than there * needs to be. Ideally it would have only (void*)data and methods. */ -/* mutt_sasl_setup_conn: replace connection methods, sockdata with +/* mutt_sasl_setup_conn: replace connection methods, sockdata with * SASL wrappers, for protection layers. Also get ssf, as a fastpath * for the read/write methods. */ void mutt_sasl_setup_conn (CONNECTION* conn, sasl_conn_t* saslconn) @@ -425,7 +425,7 @@ static int mutt_sasl_cb_authname (void* context, int id, const char** result, return SASL_FAIL; *result = account->user; } - + if (len) *len = strlen (*result); @@ -522,7 +522,7 @@ static int mutt_sasl_conn_read (CONNECTION* conn, char* buf, size_t len) return olen; } - + conn->sockdata = sasldata->sockdata; sasldata->bpos = 0; @@ -606,7 +606,7 @@ static int mutt_sasl_conn_write (CONNECTION* conn, const char* buf, else /* just write using the underlying socket function */ rc = (sasldata->msasl_write) (conn, buf, len); - + conn->sockdata = sasldata; return rc; diff --git a/mutt_sasl.h b/mutt_sasl.h index f1a2c9be..83a2cf34 100644 --- a/mutt_sasl.h +++ b/mutt_sasl.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2005,2008 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* common SASL helper routines */ @@ -31,7 +31,7 @@ int mutt_sasl_interact (sasl_interact_t*); void mutt_sasl_setup_conn (CONNECTION*, sasl_conn_t*); void mutt_sasl_done (void); -typedef struct +typedef struct { sasl_conn_t* saslconn; const sasl_ssf_t* ssf; diff --git a/mutt_socket.c b/mutt_socket.c index dc845865..5312d382 100644 --- a/mutt_socket.c +++ b/mutt_socket.c @@ -2,21 +2,21 @@ * Copyright (C) 1998,2000 Michael R. Elkins * Copyright (C) 1999-2006,2008 Brendan Cully * Copyright (C) 1999-2000 Tommi Komulainen - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -58,7 +58,7 @@ static int socket_connect (int fd, struct sockaddr* sa); static CONNECTION* socket_new_conn (void); /* Wrappers */ -int mutt_socket_open (CONNECTION* conn) +int mutt_socket_open (CONNECTION* conn) { int rc; @@ -126,7 +126,7 @@ int mutt_socket_write_d (CONNECTION *conn, const char *buf, int len, int dbg) if (len < 0) len = mutt_strlen (buf); - + while (sent < len) { if ((rc = conn->conn_write (conn, buf + sent, len - sent)) < 0) @@ -143,7 +143,7 @@ int mutt_socket_write_d (CONNECTION *conn, const char *buf, int len, int dbg) dprint (3, (debugfile, "mutt_socket_write: short write (%d of %d bytes)\n", rc, len - sent)); - + sent += rc; } @@ -218,7 +218,7 @@ int mutt_socket_readln_d (char* buf, size_t buflen, CONNECTION* conn, int dbg) buf[i] = '\0'; dprint (dbg, (debugfile, "%d< %s\n", conn->fd, buf)); - + /* number of bytes read, not strlen */ return i + 1; } @@ -290,7 +290,7 @@ CONNECTION* mutt_conn_find (const CONNECTION* start, const ACCOUNT* account) if (Tunnel && *Tunnel) mutt_tunnel_socket_setup (conn); - else if (account->flags & MUTT_ACCT_SSL) + else if (account->flags & MUTT_ACCT_SSL) { #if defined(USE_SSL) if (mutt_ssl_socket_setup (conn) < 0) @@ -333,7 +333,7 @@ static int socket_preconnect (void) save_errno = errno; mutt_perror (_("Preconnect command failed.")); mutt_sleep (1); - + return save_errno; } } @@ -477,7 +477,7 @@ int raw_socket_open (CONNECTION* conn) int fd; char *host_idna = NULL; - + #ifdef HAVE_GETADDRINFO /* --- IPv4/6 --- */ @@ -498,7 +498,7 @@ int raw_socket_open (CONNECTION* conn) hints.ai_socktype = SOCK_STREAM; snprintf (port, sizeof (port), "%d", conn->account.port); - + # if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) if (idna_to_ascii_lz (conn->account.host, &host_idna, 1) != IDNA_SUCCESS) { @@ -511,7 +511,7 @@ int raw_socket_open (CONNECTION* conn) if (!option(OPTNOCURSES)) mutt_message (_("Looking up %s..."), conn->account.host); - + rc = getaddrinfo (host_idna, port, &hints, &res); # if defined(HAVE_LIBIDN) || defined(HAVE_LIBIDN2) @@ -526,7 +526,7 @@ int raw_socket_open (CONNECTION* conn) } if (!option(OPTNOCURSES)) - mutt_message (_("Connecting to %s..."), conn->account.host); + mutt_message (_("Connecting to %s..."), conn->account.host); rc = -1; for (cur = res; cur != NULL; cur = cur->ai_next) @@ -579,12 +579,12 @@ int raw_socket_open (CONNECTION* conn) if (! he) { mutt_error (_("Could not find the host \"%s\""), conn->account.host); - + return -1; } if (!option(OPTNOCURSES)) - mutt_message (_("Connecting to %s..."), conn->account.host); + mutt_message (_("Connecting to %s..."), conn->account.host); rc = -1; for (i = 0; he->h_addr_list[i] != NULL; i++) @@ -613,6 +613,6 @@ int raw_socket_open (CONNECTION* conn) mutt_sleep (2); return -1; } - + return 0; } diff --git a/mutt_socket.h b/mutt_socket.h index e69b71b6..f00b4504 100644 --- a/mutt_socket.h +++ b/mutt_socket.h @@ -1,21 +1,21 @@ /* * Copyright (C) 1998 Brandon Long * Copyright (C) 1999-2005 Brendan Cully - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _MUTT_SOCKET_H_ #define _MUTT_SOCKET_H_ 1 diff --git a/mutt_ssl.h b/mutt_ssl.h index d579ab48..ad0e74c9 100644 --- a/mutt_ssl.h +++ b/mutt_ssl.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1999-2000 Tommi Komulainen - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _MUTT_SSL_H_ #define _MUTT_SSL_H_ 1 diff --git a/muttlib.c b/muttlib.c index c9683f4e..0418d452 100644 --- a/muttlib.c +++ b/muttlib.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins * Copyright (C) 1999-2008 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -49,7 +49,7 @@ BODY *mutt_new_body (void) { BODY *p = (BODY *) safe_calloc (1, sizeof (BODY)); - + p->disposition = DISPATTACH; p->use_disp = 1; return (p); @@ -87,7 +87,7 @@ out: } /* Modified by blong to accept a "suggestion" for file name. If - * that file exists, then construct one with unique name but + * that file exists, then construct one with unique name but * keep any extension. This might fail, I guess. * Renamed to mutt_adv_mktemp so I only have to change where it's * called, and not all possible cases. @@ -127,7 +127,7 @@ int mutt_copy_body (FILE *fp, BODY **tgt, BODY *src) BODY *b; PARAMETER *par, **ppar; - + short use_disp; if (src->filename) @@ -144,7 +144,7 @@ int mutt_copy_body (FILE *fp, BODY **tgt, BODY *src) mutt_adv_mktemp (tmp, sizeof (tmp)); if (mutt_save_attachment (fp, src, tmp, 0, NULL) == -1) return -1; - + *tgt = mutt_new_body (); b = *tgt; @@ -169,13 +169,13 @@ int mutt_copy_body (FILE *fp, BODY **tgt, BODY *src) b->d_filename = safe_strdup (src->filename); b->description = safe_strdup (b->description); - /* + /* * we don't seem to need the HEADER structure currently. * XXX - this may change in the future */ if (b->hdr) b->hdr = NULL; - + /* copy parameters */ for (par = b->parameter, ppar = &b->parameter; par; ppar = &(*ppar)->next, par = par->next) { @@ -185,7 +185,7 @@ int mutt_copy_body (FILE *fp, BODY **tgt, BODY *src) } mutt_stamp_attachment (b); - + return 0; } @@ -198,7 +198,7 @@ void mutt_free_body (BODY **p) while (a) { b = a; - a = a->next; + a = a->next; if (b->parameter) mutt_free_parameter (&b->parameter); @@ -263,7 +263,7 @@ LIST *mutt_add_list (LIST *head, const char *data) LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) { LIST *tmp; - + for (tmp = head; tmp && tmp->next; tmp = tmp->next) ; if (tmp) @@ -273,7 +273,7 @@ LIST *mutt_add_list_n (LIST *head, const void *data, size_t len) } else head = tmp = safe_malloc (sizeof (LIST)); - + tmp->data = safe_malloc (len); if (len) memcpy (tmp->data, data, len); @@ -335,7 +335,7 @@ int mutt_remove_from_rx_list (RX_LIST **l, const char *str) void mutt_free_list (LIST **list) { LIST *p; - + if (!list) return; while (*list) { @@ -356,7 +356,7 @@ LIST *mutt_copy_list (LIST *p) t->data = safe_strdup (p->data); t->next = NULL; if (l) - { + { r->next = t; r = r->next; } @@ -440,11 +440,11 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) char tmp[_POSIX_PATH_MAX]; char *t; - char *tail = ""; + char *tail = ""; int recurse = 0; - - do + + do { recurse = 0; @@ -460,7 +460,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) else { struct passwd *pw; - if ((t = strchr (s + 1, '/'))) + if ((t = strchr (s + 1, '/'))) *t = 0; if ((pw = getpwnam (s + 1))) @@ -485,9 +485,9 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) } } break; - + case '=': - case '+': + case '+': { #ifdef USE_IMAP /* if folder = {host} or imap[s]://host/: don't append slash */ @@ -501,18 +501,18 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) strfcpy (p, NONULL (Maildir), sizeof (p)); else snprintf (p, sizeof (p), "%s/", NONULL (Maildir)); - + tail = s + 1; } break; - + /* elm compatibility, @ expands alias to user name */ - + case '@': { HEADER *h; ADDRESS *alias; - + if ((alias = mutt_lookup_alias (s + 1))) { h = mutt_new_header(); @@ -524,26 +524,26 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) /* Avoid infinite recursion if the resulting folder starts with '@' */ if (*p != '@') recurse = 1; - + tail = ""; } } break; - + case '>': { strfcpy (p, NONULL(Inbox), sizeof (p)); tail = s + 1; } break; - + case '<': { strfcpy (p, NONULL(Outbox), sizeof (p)); tail = s + 1; } break; - + case '!': { if (*(s+1) == '!') @@ -551,22 +551,22 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) strfcpy (p, NONULL(LastFolder), sizeof (p)); tail = s + 2; } - else + else { strfcpy (p, NONULL(Spoolfile), sizeof (p)); tail = s + 1; } } break; - + case '-': { strfcpy (p, NONULL(LastFolder), sizeof (p)); tail = s + 1; } break; - - case '^': + + case '^': { strfcpy (p, NONULL(CurrentFolder), sizeof (p)); tail = s + 1; @@ -587,7 +587,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) } else snprintf (tmp, sizeof (tmp), "%s%s", p, tail); - + strfcpy (s, tmp, slen); } while (recurse); @@ -604,7 +604,7 @@ char *_mutt_expand_path (char *s, size_t slen, int rx) /* Extract the real name from /etc/passwd's GECOS field. * When set, honor the regular expression in GecosMask, - * otherwise assume that the GECOS field is a + * otherwise assume that the GECOS field is a * comma-separated list. * Replace "&" by a capitalized version of the user's login * name. @@ -616,16 +616,16 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) size_t pwnl; int idx; char *p; - - if (!pw || !pw->pw_gecos) + + if (!pw || !pw->pw_gecos) return NULL; memset (dest, 0, destlen); - + if (GecosMask.rx) { if (regexec (GecosMask.rx, pw->pw_gecos, 1, pat_match, 0) == 0) - strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so, + strfcpy (dest, pw->pw_gecos + pat_match[0].rm_so, MIN (pat_match[0].rm_eo - pat_match[0].rm_so + 1, destlen)); } else if ((p = strchr (pw->pw_gecos, ','))) @@ -645,10 +645,10 @@ char *mutt_gecos_name (char *dest, size_t destlen, struct passwd *pw) dest[idx] = toupper ((unsigned char) dest[idx]); } } - + return dest; } - + char *mutt_get_parameter (const char *s, PARAMETER *p) { @@ -668,7 +668,7 @@ void mutt_set_parameter (const char *attribute, const char *value, PARAMETER **p mutt_delete_parameter (attribute, p); return; } - + for(q = *p; q; q = q->next) { if (ascii_strcasecmp (attribute, q->attribute) == 0) @@ -677,7 +677,7 @@ void mutt_set_parameter (const char *attribute, const char *value, PARAMETER **p return; } } - + q = mutt_new_parameter(); q->attribute = safe_strdup(attribute); q->value = safe_strdup(value); @@ -688,7 +688,7 @@ void mutt_set_parameter (const char *attribute, const char *value, PARAMETER **p void mutt_delete_parameter (const char *attribute, PARAMETER **p) { PARAMETER *q; - + for (q = *p; q; p = &q->next, q = q->next) { if (ascii_strcasecmp (attribute, q->attribute) == 0) @@ -730,7 +730,7 @@ int mutt_is_text_part (BODY *b) { int t = b->type; char *s = b->subtype; - + if ((WithCrypto & APPLICATION_PGP) && mutt_is_application_pgp (b)) return 0; @@ -812,7 +812,7 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra) { MOVE_ELEM(in_reply_to); } - + /* real_subj is subordinate to subject */ if (!base->subject) { @@ -830,7 +830,7 @@ void mutt_merge_envelopes(ENVELOPE* base, ENVELOPE** extra) MOVE_ELEM(spam); MOVE_ELEM(userhdrs); #undef MOVE_ELEM - + mutt_free_envelope(extra); } @@ -929,7 +929,7 @@ void mutt_pretty_mailbox (char *s, size_t buflen) } *q = 0; } - else if (strstr (p, "..") && + else if (strstr (p, "..") && (scheme == U_UNKNOWN || scheme == U_FILE) && realpath (p, tmp)) strfcpy (p, tmp, buflen - (p - s)); @@ -975,7 +975,7 @@ void mutt_pretty_size (char *s, size_t len, LOFF_T n) void mutt_expand_file_fmt (char *dest, size_t destlen, const char *fmt, const char *src) { char tmp[LONG_STRING]; - + mutt_quote_filename (tmp, sizeof (tmp), src); mutt_expand_fmt (dest, destlen, fmt, tmp); } @@ -989,10 +989,10 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt, const char *s slen = mutt_strlen (src); destlen--; - + for (p = fmt, d = dest; destlen && *p; p++) { - if (*p == '%') + if (*p == '%') { switch (p[1]) { @@ -1008,7 +1008,7 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt, const char *s p++; break; default: - *d++ = *p; + *d++ = *p; destlen--; break; } @@ -1019,20 +1019,20 @@ void mutt_expand_fmt (char *dest, size_t destlen, const char *fmt, const char *s destlen--; } } - + *d = '\0'; - + if (!found && destlen > 0) { safe_strcat (dest, destlen, " "); safe_strcat (dest, destlen, src); } - + } /* return 0 on success, -1 on abort, 1 on error */ int mutt_check_overwrite (const char *attname, const char *path, - char *fname, size_t flen, int *append, char **directory) + char *fname, size_t flen, int *append, char **directory) { int rc = 0; char tmp[_POSIX_PATH_MAX]; @@ -1079,7 +1079,7 @@ int mutt_check_overwrite (const char *attname, const char *path, return (-1); mutt_concat_path (fname, path, tmp, flen); } - + if (*append == 0 && access (fname, F_OK) == 0) { switch (mutt_multi_choice @@ -1550,30 +1550,30 @@ void mutt_FormatString (char *dest, /* output buffer */ { short tolower = 0; short nodots = 0; - - while (ch == '_' || ch == ':') + + while (ch == '_' || ch == ':') { if (ch == '_') tolower = 1; - else if (ch == ':') + else if (ch == ':') nodots = 1; - + ch = *src++; } - + /* use callback function to handle this case */ src = callback (buf, sizeof (buf), col, cols, ch, src, prefix, ifstring, elsestring, data, flags); if (tolower) mutt_strlower (buf); - if (nodots) + if (nodots) { char *p = buf; for (; *p; p++) if (*p == '.') *p = '_'; } - + if ((len = mutt_strlen (buf)) + wlen > destlen) len = mutt_wstr_trunc (buf, destlen - wlen, cols - col, NULL); @@ -1761,7 +1761,7 @@ int state_printf (STATE *s, const char *fmt, ...) va_start (ap, fmt); rv = vfprintf (s->fpout, fmt, ap); va_end (ap); - + return rv; } @@ -1821,7 +1821,7 @@ void mutt_display_sanitize (char *s) *s = '?'; } } - + void mutt_sleep (short s) { if (SleepTime > s) @@ -1837,7 +1837,7 @@ time_t mutt_decrease_mtime (const char *f, struct stat *st) struct utimbuf utim; struct stat _st; time_t mtime; - + if (!st) { if (stat (f, &_st) == -1) @@ -1852,7 +1852,7 @@ time_t mutt_decrease_mtime (const char *f, struct stat *st) utim.modtime = mtime; utime (f, &utim); } - + return mtime; } @@ -1970,7 +1970,7 @@ void mutt_free_regexp (REGEXP **pp) void mutt_free_rx_list (RX_LIST **list) { RX_LIST *p; - + if (!list) return; while (*list) { @@ -1984,7 +1984,7 @@ void mutt_free_rx_list (RX_LIST **list) void mutt_free_replace_list (REPLACE_LIST **list) { REPLACE_LIST *p; - + if (!list) return; while (*list) { @@ -1999,7 +1999,7 @@ void mutt_free_replace_list (REPLACE_LIST **list) int mutt_match_rx_list (const char *s, RX_LIST *l) { if (!s) return 0; - + for (; l; l = l->next) { if (regexec (l->rx->rx, s, (size_t) 0, (regmatch_t *) 0, (int) 0) == 0) diff --git a/mx.c b/mx.c index d7743e78..6a9c189a 100644 --- a/mx.c +++ b/mx.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2002,2010,2013 Michael R. Elkins * Copyright (C) 1999-2003 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -96,7 +96,7 @@ struct mx_ops* mx_get_ops (int magic) #define mutt_is_spool(s) (mutt_strcmp (Spoolfile, s) == 0) #ifdef USE_DOTLOCK -/* parameters: +/* parameters: * path - file to lock * retry - should retry if unable to lock? */ @@ -108,12 +108,12 @@ static int invoke_dotlock (const char *path, int dummy, int flags, int retry) char cmd[LONG_STRING + _POSIX_PATH_MAX]; char f[SHORT_STRING + _POSIX_PATH_MAX]; char r[SHORT_STRING]; - + if (flags & DL_FL_RETRY) snprintf (r, sizeof (r), "-r %d ", retry ? MAXLOCKATTEMPT : 0); - + mutt_quote_filename (f, sizeof (f), path); - + snprintf (cmd, sizeof (cmd), "%s %s%s%s%s%s%s%s", NONULL (MuttDotlock), @@ -124,11 +124,11 @@ static int invoke_dotlock (const char *path, int dummy, int flags, int retry) flags & DL_FL_UNLINK ? "-d " : "", flags & DL_FL_RETRY ? r : "", f); - + return mutt_system (cmd); } -#else +#else #define invoke_dotlock dotlock_invoke @@ -147,7 +147,7 @@ retry_lock: if (!option (OPTNOCURSES)) { char msg[LONG_STRING]; - + snprintf(msg, sizeof(msg), _("Lock count exceeded, remove lock for %s?"), path); if(retry && mutt_yesorno(msg, MUTT_YES) == MUTT_YES) @@ -157,7 +157,7 @@ retry_lock: mutt_clear_error (); goto retry_lock; } - } + } else { mutt_error ( _("Can't dotlock %s.\n"), path); @@ -168,7 +168,7 @@ retry_lock: static int undotlock_file (const char *path, int fd) { - return (invoke_dotlock(path, fd, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) == DL_EX_OK ? + return (invoke_dotlock(path, fd, DL_FL_USEPRIV | DL_FL_UNLOCK, 0) == DL_EX_OK ? 0 : -1); } @@ -190,7 +190,7 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout) #ifdef USE_FCNTL struct flock lck; - + memset (&lck, 0, sizeof (struct flock)); lck.l_type = excl ? F_WRLCK : F_RDLCK; lck.l_whence = SEEK_SET; @@ -208,7 +208,7 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout) if (fstat (fd, &sb) != 0) sb.st_size = 0; - + if (count == 0) prev_sb = sb; @@ -241,7 +241,7 @@ int mx_lock_file (const char *path, int fd, int excl, int dot, int timeout) if (fstat(fd, &sb) != 0) sb.st_size = 0; - + if (count == 0) prev_sb = sb; @@ -302,7 +302,7 @@ int mx_unlock_file (const char *path, int fd, int dot) if (dot) undotlock_file (path, fd); #endif - + return 0; } @@ -677,7 +677,7 @@ void mx_fastclose_mailbox (CONTEXT *ctx) struct utimbuf ut; #endif /* HAVE_UTIMENSAT */ - if(!ctx) + if(!ctx) return; /* fix up the times so buffy won't get confused */ @@ -720,7 +720,7 @@ void mx_fastclose_mailbox (CONTEXT *ctx) FREE (&ctx->path); FREE (&ctx->realpath); FREE (&ctx->pattern); - if (ctx->limit_pattern) + if (ctx->limit_pattern) mutt_pattern_free (&ctx->limit_pattern); safe_fclose (&ctx->fp); memset (ctx, 0, sizeof (CONTEXT)); @@ -839,7 +839,7 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) for (i = 0; i < ctx->msgcount; i++) { - if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read + if (!ctx->hdrs[i]->deleted && ctx->hdrs[i]->read && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED))) read_msgs++; } @@ -872,7 +872,7 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) } } - /* + /* * There is no point in asking whether or not to purge if we are * just marking messages as "trash". */ @@ -905,20 +905,20 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) #ifdef USE_IMAP /* try to use server-side copy first */ i = 1; - + if (ctx->magic == MUTT_IMAP && mx_is_imap (mbox)) { /* tag messages for moving, and clear old tags, if any */ for (i = 0; i < ctx->msgcount; i++) if (ctx->hdrs[i]->read && !ctx->hdrs[i]->deleted - && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED))) + && !(ctx->hdrs[i]->flagged && option (OPTKEEPFLAGGED))) ctx->hdrs[i]->tagged = 1; else ctx->hdrs[i]->tagged = 0; - + i = imap_copy_messages (ctx, NULL, mbox, 1); } - + if (i == 0) /* success */ mutt_clear_error (); else if (i == -1) /* horrible error, bail */ @@ -953,10 +953,10 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) } } } - + mx_close_mailbox (&f, NULL); } - + } else if (!ctx->changed && ctx->deleted == 0) { @@ -1055,7 +1055,7 @@ int mx_close_mailbox (CONTEXT *ctx, int *index_hint) void mx_update_tables(CONTEXT *ctx, int committing) { int i, j, padding; - + /* update memory to reflect the new state of the mailbox */ ctx->vcount = 0; ctx->vsize = 0; @@ -1069,7 +1069,7 @@ void mx_update_tables(CONTEXT *ctx, int committing) #define this_body ctx->hdrs[j]->content for (i = 0, j = 0; i < ctx->msgcount; i++) { - if ((committing && (!ctx->hdrs[i]->deleted || + if ((committing && (!ctx->hdrs[i]->deleted || (ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH)))) || (!committing && ctx->hdrs[i]->active)) { @@ -1094,7 +1094,7 @@ void mx_update_tables(CONTEXT *ctx, int committing) } else if (ctx->hdrs[j]->changed) ctx->changed = 1; - + if (!committing || (ctx->magic == MUTT_MAILDIR && option (OPTMAILDIRTRASH))) { if (ctx->hdrs[j]->deleted) @@ -1106,11 +1106,11 @@ void mx_update_tables(CONTEXT *ctx, int committing) if (ctx->hdrs[j]->flagged) ctx->flagged++; if (!ctx->hdrs[j]->read) - { + { ctx->unread++; if (!ctx->hdrs[j]->old) ctx->new++; - } + } j++; } @@ -1240,7 +1240,7 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint) } mutt_sleep (0); - + if (ctx->msgcount == ctx->deleted && (ctx->magic == MUTT_MBOX || ctx->magic == MUTT_MMDF) && !mutt_is_spool (ctx->path) && !option (OPTSAVEEMPTY)) @@ -1251,9 +1251,9 @@ int mx_sync_mailbox (CONTEXT *ctx, int *index_hint) } /* if we haven't deleted any messages, we don't need to resort */ - /* ... except for certain folder formats which need "unsorted" + /* ... except for certain folder formats which need "unsorted" * sort order in order to synchronize folders. - * + * * MH and maildir are safe. mbox-style seems to need re-sorting, * at least with the new threading code. */ @@ -1401,14 +1401,14 @@ void mx_alloc_memory (CONTEXT *ctx) { int i; size_t s = MAX (sizeof (HEADER *), sizeof (int)); - + if ((ctx->hdrmax + 25) * s < ctx->hdrmax * s) { mutt_error _("Integer overflow -- can't allocate memory."); sleep (1); mutt_exit (1); } - + if (ctx->hdrs) { safe_realloc (&ctx->hdrs, sizeof (HEADER *) * (ctx->hdrmax += 25)); @@ -1457,7 +1457,7 @@ void mx_update_context (CONTEXT *ctx, int new_messages) { HEADER *h2; - if (!ctx->id_hash) + if (!ctx->id_hash) ctx->id_hash = mutt_make_id_hash (ctx); h2 = hash_find (ctx->id_hash, h->env->supersedes); @@ -1466,7 +1466,7 @@ void mx_update_context (CONTEXT *ctx, int new_messages) if (h2) { h2->superseded = 1; - if (option (OPTSCORE)) + if (option (OPTSCORE)) mutt_score_message (ctx, h2, 1); } } @@ -1478,7 +1478,7 @@ void mx_update_context (CONTEXT *ctx, int new_messages) hash_insert (ctx->subj_hash, h->env->real_subj, h); mutt_label_hash_add (ctx, h); - if (option (OPTSCORE)) + if (option (OPTSCORE)) mutt_score_message (ctx, h, 0); if (h->changed) diff --git a/mx.h b/mx.h index f5563d82..d9dc4da7 100644 --- a/mx.h +++ b/mx.h @@ -6,16 +6,16 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * This header file contains prototypes for internal functions used by the diff --git a/pager.c b/pager.c index b4c78f53..248bf1a3 100644 --- a/pager.c +++ b/pager.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2007,2010,2012-2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -289,11 +289,11 @@ resolve_color (struct line_t *lineInfo, int n, int cnt, int flags, int special, else color ^= A_UNDERLINE; } - else if (a->attr & ANSI_REVERSE) + else if (a->attr & ANSI_REVERSE) { color ^= A_REVERSE; } - else if (a->attr & ANSI_BLINK) + else if (a->attr & ANSI_BLINK) { color ^= A_BLINK; } @@ -324,7 +324,7 @@ append_line (struct line_t *lineInfo, int n, int cnt) if (lineInfo[m].continuation == 0) break; (lineInfo[n+1].syntax)[0].first = m; - (lineInfo[n+1].syntax)[0].last = (lineInfo[n].continuation) ? + (lineInfo[n+1].syntax)[0].last = (lineInfo[n].continuation) ? cnt + (lineInfo[n].syntax)[0].last : cnt; } @@ -516,7 +516,7 @@ classify_quote (struct q_class_t **QuoteList, const char *qptr, else { /* case 2: try subclassing the current top level node */ - + /* tmp != NULL means we already found a shorter prefix at case 1 */ if (tmp == NULL && mutt_strncmp (qptr, q_list->prefix, q_list->length) == 0) { @@ -543,12 +543,12 @@ classify_quote (struct q_class_t **QuoteList, const char *qptr, if (tmp == NULL) { /* add a node above q_list */ - tmp = (struct q_class_t *) safe_calloc (1, + tmp = (struct q_class_t *) safe_calloc (1, sizeof (struct q_class_t)); tmp->prefix = (char *) safe_calloc (1, length + 1); strncpy (tmp->prefix, qptr, length); tmp->length = length; - + /* replace q_list by tmp */ if (q_list->next) { @@ -571,7 +571,7 @@ classify_quote (struct q_class_t **QuoteList, const char *qptr, /* q_list has no siblings */ q_list->next = NULL; q_list->prev = NULL; - + index = q_list->index; /* tmp should be the return class too */ @@ -835,7 +835,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, if (lineInfo[i].chunks) { lineInfo[i].chunks = 0; - safe_realloc (&(lineInfo[n].syntax), + safe_realloc (&(lineInfo[n].syntax), sizeof (struct syntax_t)); } lineInfo[i++].type = MT_COLOR_SIGNATURE; @@ -905,7 +905,7 @@ resolve_types (char *buf, char *raw, struct line_t *lineInfo, int n, int last, break; } if (++(lineInfo[n].chunks) > 1) - safe_realloc (&(lineInfo[n].syntax), + safe_realloc (&(lineInfo[n].syntax), (lineInfo[n].chunks) * sizeof (struct syntax_t)); } i = lineInfo[n].chunks - 1; @@ -993,7 +993,7 @@ static int grok_ansi(unsigned char *buf, int pos, ansi_attr *a) { a->attr |= ANSI_BOLD; pos += 2; - } + } else if (buf[pos] == '4' && (pos+1 == x || buf[pos+1] == ';')) { a->attr |= ANSI_UNDERLINE; @@ -1041,7 +1041,7 @@ static int grok_ansi(unsigned char *buf, int pos, ansi_attr *a) a->bg = buf[pos+1] - '0'; pos += 3; } - else + else { while (pos < x && buf[pos] != ';') pos++; pos++; @@ -1152,7 +1152,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, /* is anything left to do? */ if (ch >= cnt) break; - + k = mbrtowc (&wc, (char *)buf+ch, cnt-ch, &mbstate); if (k == (size_t)(-2) || k == (size_t)(-1)) { @@ -1309,7 +1309,7 @@ static int format_line (struct line_t **lineInfo, int n, unsigned char *buf, */ static int -display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, +display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, int *last, int *max, int flags, struct q_class_t **QuoteList, int *q_level, int *force_redraw, regex_t *SearchRE, mutt_window_t *pager_window) @@ -1372,7 +1372,7 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, flags = 0; /* MUTT_NOSHOW */ } - /* At this point, (*lineInfo[n]).quote may still be undefined. We + /* At this point, (*lineInfo[n]).quote may still be undefined. We * don't want to compute it every time MUTT_TYPES is set, since this * would slow down the "bottom" function unacceptably. A compromise * solution is hence to call regexec() again, just to find out the @@ -1394,7 +1394,7 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, force_redraw, q_level); } - if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation && (*lineInfo)[n].search_cnt == -1) + if ((flags & MUTT_SEARCH) && !(*lineInfo)[n].continuation && (*lineInfo)[n].search_cnt == -1) { if (fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready) < 0) { @@ -1439,7 +1439,7 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, goto out; /* fake display */ } - if ((b_read = fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, + if ((b_read = fill_buffer (f, last_pos, (*lineInfo)[n].offset, &buf, &fmt, &buflen, &buf_ready)) < 0) { if (change_last) @@ -1475,7 +1475,7 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, } if (!(flags & MUTT_PAGER_NSKIP)) /* skip leading blanks on the next line too */ - while (*buf_ptr == ' ' || *buf_ptr == '\t') + while (*buf_ptr == ' ' || *buf_ptr == '\t') buf_ptr++; } @@ -1511,7 +1511,7 @@ display_line (FILE *f, LOFF_T *last_pos, struct line_t **lineInfo, int n, /* end the last color pattern (needed by S-Lang) */ if (special || (col != pager_window->cols && (flags & (MUTT_SHOWCOLOR | MUTT_SEARCH)))) resolve_color (*lineInfo, n, vch, flags, 0, &a); - + /* * Fill the blank space at the end of the line with the prevailing color. * ncurses does an implicit clrtoeol() when you do addch('\n') so we have @@ -1805,7 +1805,7 @@ static void pager_menu_redraw (MUTTMENU *pager_menu) while (rd->lines < rd->pager_window->rows && rd->lineInfo[rd->curline].offset <= rd->sb.st_size - 1) { - if (display_line (rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline, &rd->lastLine, + if (display_line (rd->fp, &rd->last_pos, &rd->lineInfo, rd->curline, &rd->lastLine, &rd->maxLine, (rd->flags & MUTT_DISPLAYFLAGS) | rd->hideQuoted | rd->SearchFlag | (rd->flags & MUTT_PAGER_NOWRAP), &rd->QuoteList, &rd->q_level, &rd->force_redraw, &rd->SearchRE, @@ -1899,7 +1899,7 @@ static void pager_menu_redraw (MUTTMENU *pager_menu) can be distinguished by whether or not ``hdr'' is NULL. The ``hdr'' arg is there so that we can do operations on the current message without the need to pop back out to the main-menu. */ -int +int mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) { static char searchbuf[STRING] = ""; @@ -2012,7 +2012,7 @@ mutt_pager (const char *banner, const char *fname, int flags, pager_t *extra) } else OldHdr = NULL; - + ch = km_dokey (MENU_PAGER); if (ch >= 0) mutt_clear_error (); @@ -2174,7 +2174,7 @@ search_next: /* searching forward */ for (i = wrapped ? 0 : rd.topline + searchctx + 1; i < rd.lastLine; i++) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && + if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) break; } @@ -2195,8 +2195,8 @@ search_next: /* searching backward */ for (i = wrapped ? rd.lastLine : rd.topline + searchctx - 1; i >= 0; i--) { - if ((!rd.hideQuoted || (rd.has_types && - rd.lineInfo[i].type != MT_COLOR_QUOTED)) && + if ((!rd.hideQuoted || (rd.has_types && + rd.lineInfo[i].type != MT_COLOR_QUOTED)) && !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) break; } @@ -2248,10 +2248,10 @@ search_next: goto search_next; } } - + if (!buffer[0]) break; - + strfcpy (searchbuf, buffer, sizeof (searchbuf)); /* leave SearchBack alone if ch == OP_SEARCH_NEXT */ @@ -2290,7 +2290,7 @@ search_next: rd.SearchCompiled = 1; /* update the search pointers */ i = 0; - while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, + while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, &rd.maxLine, MUTT_SEARCH | (flags & MUTT_PAGER_NSKIP) | (flags & MUTT_PAGER_NOWRAP), &rd.QuoteList, &rd.q_level, &rd.force_redraw, &rd.SearchRE, rd.pager_window) == 0) @@ -2301,7 +2301,7 @@ search_next: /* searching forward */ for (i = rd.topline; i < rd.lastLine; i++) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && + if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) break; } @@ -2313,7 +2313,7 @@ search_next: /* searching backward */ for (i = rd.topline; i >= 0; i--) { - if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && + if ((!rd.hideQuoted || rd.lineInfo[i].type != MT_COLOR_QUOTED) && !rd.lineInfo[i].continuation && rd.lineInfo[i].search_cnt > 0) break; } @@ -2419,7 +2419,7 @@ search_next: if (dretval < 0) { mutt_error _("No more unquoted text after quoted text."); - break; + break; } rd.topline = new_topline; } @@ -2430,7 +2430,7 @@ search_next: { i = rd.curline; /* make sure the types are defined to the end of file */ - while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, + while (display_line (rd.fp, &rd.last_pos, &rd.lineInfo, i, &rd.lastLine, &rd.maxLine, rd.has_types | (flags & MUTT_PAGER_NOWRAP), &rd.QuoteList, &rd.q_level, &rd.force_redraw, &rd.SearchRE, rd.pager_window) == 0) @@ -2480,7 +2480,7 @@ search_next: CHECK_MODE (IsHeader (extra)); if (!(WithCrypto & APPLICATION_PGP)) break; - if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED)) + if (!(extra->hdr->security & PGP_TRADITIONAL_CHECKED)) { ch = -1; rc = OP_CHECK_TRADITIONAL; @@ -2638,15 +2638,15 @@ search_next: case OP_MAIL: CHECK_MODE(IsHeader (extra) && !IsAttach (extra)); - CHECK_ATTACH; + CHECK_ATTACH; ci_send_message (0, NULL, NULL, extra->ctx, NULL); pager_menu->redraw = REDRAW_FULL; break; case OP_REPLY: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); - CHECK_ATTACH; - if (IsMsgAttach (extra)) + CHECK_ATTACH; + if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->actx, extra->bdy, SENDREPLY); else @@ -2674,7 +2674,7 @@ search_next: case OP_LIST_REPLY: CHECK_MODE(IsHeader (extra) || IsMsgAttach (extra)); - CHECK_ATTACH; + CHECK_ATTACH; if (IsMsgAttach (extra)) mutt_attach_reply (extra->fp, extra->hdr, extra->actx, extra->bdy, SENDREPLY|SENDLISTREPLY); @@ -2930,9 +2930,9 @@ search_next: break; } } - + cleanup_quote (&rd.QuoteList); - + for (i = 0; i < rd.maxLine ; i++) { FREE (&(rd.lineInfo[i].syntax)); diff --git a/pager.h b/pager.h index f3fd1f1a..a3c31eda 100644 --- a/pager.h +++ b/pager.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #include "attach.h" diff --git a/parse.c b/parse.c index 44251123..6cf22cbd 100644 --- a/parse.c +++ b/parse.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2012-2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -48,7 +48,7 @@ char *mutt_read_rfc822_line (FILE *f, char *line, size_t *linelen) FOREVER { if (fgets (buf, *linelen - offset, f) == NULL || /* end of file or */ - (ISSPACE (*line) && !offset)) /* end of headers */ + (ISSPACE (*line) && !offset)) /* end of headers */ { *line = 0; return (line); @@ -144,7 +144,7 @@ static PARAMETER *parse_parameters (const char *s) size_t i; dprint (2, (debugfile, "parse_parameters: `%s'\n", s)); - + while (*s) { if ((p = strpbrk (s, "=;")) == NULL) @@ -252,7 +252,7 @@ static PARAMETER *parse_parameters (const char *s) s = skip_email_wsp(s + 1); } while (*s == ';'); /* skip empty parameters */ - } + } bail: @@ -266,7 +266,7 @@ int mutt_check_mime_type (const char *s) return TYPETEXT; else if (ascii_strcasecmp ("multipart", s) == 0) return TYPEMULTIPART; -#ifdef SUN_ATTACHMENT +#ifdef SUN_ATTACHMENT else if (ascii_strcasecmp ("x-sun-attachment", s) == 0) return TYPEMULTIPART; #endif @@ -311,15 +311,15 @@ void mutt_parse_content_type (char *s, BODY *ct) * let that take precedence, and don't set it here */ if ((pc = mutt_get_parameter( "name", ct->parameter)) && !ct->filename) ct->filename = safe_strdup(pc); - + #ifdef SUN_ATTACHMENT /* this is deep and utter perversion */ if ((pc = mutt_get_parameter ("conversions", ct->parameter))) ct->encoding = mutt_check_encoding (pc); #endif - + } - + /* Now get the subtype */ if ((subtype = strchr(s, '/'))) { @@ -414,13 +414,13 @@ BODY *mutt_read_mime_header (FILE *fp, int digest) char *c; char *line = safe_malloc (LONG_STRING); size_t linelen = LONG_STRING; - + p->hdr_offset = ftello (fp); p->encoding = ENC7BIT; /* default from RFC1521 */ p->type = digest ? TYPEMESSAGE : TYPETEXT; p->disposition = DISPINLINE; - + while (*(line = mutt_read_rfc822_line (fp, line, &linelen)) != 0) { /* Find the value of the current header */ @@ -453,7 +453,7 @@ BODY *mutt_read_mime_header (FILE *fp, int digest) mutt_str_replace (&p->description, c); rfc2047_decode (&p->description); } - } + } #ifdef SUN_ATTACHMENT else if (!ascii_strncasecmp ("x-sun-", line, 6)) { @@ -507,7 +507,7 @@ void mutt_parse_part (FILE *fp, BODY *b) bound = mutt_get_parameter ("boundary", b->parameter); fseeko (fp, b->offset, SEEK_SET); - b->parts = mutt_parse_multipart (fp, bound, + b->parts = mutt_parse_multipart (fp, bound, b->offset + b->length, ascii_strcasecmp ("digest", b->subtype) == 0); break; @@ -642,12 +642,12 @@ BODY *mutt_parse_multipart (FILE *fp, const char *boundary, LOFF_T end_off, int break; } #endif - + /* * Consistency checking - catch * bad attachment end boundaries */ - + if(new->offset > end_off) { mutt_free_body(&new); @@ -671,7 +671,7 @@ BODY *mutt_parse_multipart (FILE *fp, const char *boundary, LOFF_T end_off, int /* parse recursive MIME parts */ for(last = head; last; last = last->next) mutt_parse_part(fp, last); - + return (head); } @@ -775,11 +775,11 @@ time_t mutt_parse_date (const char *s, HEADER *h) char scratch[SHORT_STRING]; /* Don't modify our argument. Fixed-size buffer is ok here since - * the date format imposes a natural limit. + * the date format imposes a natural limit. */ strfcpy (scratch, s, sizeof (scratch)); - + /* kill the day of the week, if it exists. */ if ((t = strchr (scratch, ','))) t++; @@ -921,7 +921,7 @@ char *mutt_extract_message_id (const char *s, const char **saveptr) { if (*p == '<') { - s = p; + s = p; o = onull = NULL; continue; } @@ -943,7 +943,7 @@ char *mutt_extract_message_id (const char *s, const char **saveptr) } /* some idiotic clients break their message-ids between lines */ - if (s == p) + if (s == p) /* step past another whitespace */ s = p + 1; else if (o) @@ -1026,7 +1026,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short short do_2047, LIST **lastp) { int matched = 0; - + switch (ascii_tolower (line[0])) { case 'a': @@ -1041,7 +1041,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'b': if (ascii_strcasecmp (line+1, "cc") == 0) { @@ -1049,7 +1049,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'c': if (ascii_strcasecmp (line+1, "c") == 0) { @@ -1096,7 +1096,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } } break; - + case 'd': if (!ascii_strcasecmp ("ate", line + 1)) { @@ -1106,13 +1106,13 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'e': if (!ascii_strcasecmp ("xpires", line + 1) && hdr && mutt_parse_date (p, NULL) < time (NULL)) hdr->expired = 1; break; - + case 'f': if (!ascii_strcasecmp ("rom", line + 1)) { @@ -1120,7 +1120,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'i': if (!ascii_strcasecmp (line+1, "n-reply-to")) { @@ -1129,15 +1129,15 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'l': if (!ascii_strcasecmp (line + 1, "ines")) { if (hdr) { - /* + /* * HACK - mutt has, for a very short time, produced negative - * Lines header values. Ignore them. + * Lines header values. Ignore them. */ if (mutt_atoi (p, &hdr->lines) < 0 || hdr->lines < 0) hdr->lines = 0; @@ -1156,7 +1156,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short ++beg; if (!(end = strchr (beg, '>'))) break; - + /* Take the first mailto URL */ if (url_check_scheme (beg) == U_MAILTO) { @@ -1171,7 +1171,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'm': if (!ascii_strcasecmp (line + 1, "ime-version")) { @@ -1202,7 +1202,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short } } break; - + case 'r': if (!ascii_strcasecmp (line + 1, "eferences")) { @@ -1225,13 +1225,13 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short if (hdr && !hdr->received) { char *d = strrchr (p, ';'); - + if (d) hdr->received = mutt_parse_date (d + 1, NULL); } } break; - + case 's': if (!ascii_strcasecmp (line + 1, "ubject")) { @@ -1274,7 +1274,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short e->supersedes = safe_strdup (p); } break; - + case 't': if (ascii_strcasecmp (line+1, "o") == 0) { @@ -1282,7 +1282,7 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short matched = 1; } break; - + case 'x': if (ascii_strcasecmp (line+1, "-status") == 0) { @@ -1315,11 +1315,11 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short e->x_label = safe_strdup(p); matched = 1; } - + default: break; } - + /* Keep track of the user-defined headers */ if (!matched && user_hdrs) { @@ -1353,8 +1353,8 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short done: return matched; } - - + + /* mutt_read_rfc822_header() -- parses a RFC822 header * * Args: @@ -1362,14 +1362,14 @@ int mutt_parse_rfc822_line (ENVELOPE *e, HEADER *hdr, char *line, char *p, short * f stream to read from * * hdr header structure of current message (optional). - * + * * user_hdrs If set, store user headers. Used for recall-message and * postpone modes. - * + * * weed If this parameter is set and the user has activated the * $weed option, honor the header weed list for user headers. * Used for recall-message. - * + * * Returns: newly allocated envelope structure. You should free it by * mutt_free_envelope() when envelope stay unneeded. */ @@ -1531,7 +1531,7 @@ ADDRESS *mutt_parse_adrlist (ADDRESS *p, const char *s) } else p = rfc822_parse_adrlist (p, s); - + return p; } @@ -1672,21 +1672,21 @@ int mutt_count_body_parts (CONTEXT *ctx, HEADER *hdr) if (hdr->attach_valid) return hdr->attach_total; - + if (hdr->content->parts) keep_parts = 1; else mutt_parse_mime_message (ctx, hdr); - + if (AttachAllow || AttachExclude || InlineAllow || InlineExclude) hdr->attach_total = count_body_parts(hdr->content, MUTT_PARTS_TOPLEVEL); else hdr->attach_total = 0; hdr->attach_valid = 1; - + if (!keep_parts) mutt_free_body (&hdr->content->parts); - + return hdr->attach_total; } diff --git a/pattern.c b/pattern.c index 1a119947..1f47e476 100644 --- a/pattern.c +++ b/pattern.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2006-2007,2010 Michael R. Elkins , and others - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -127,9 +127,9 @@ int mutt_which_case (const char *s) wchar_t w; mbstate_t mb; size_t l; - + memset (&mb, 0, sizeof (mb)); - + for (; (l = mbrtowc (&w, s, MB_CUR_MAX, &mb)) != 0; s += l) { if (l == (size_t) -2) @@ -240,7 +240,7 @@ msg_search (CONTEXT *ctx, pattern_t* pat, int msgno) } FREE (&buf); - + mx_close_message (ctx, &msg); if (option (OPTTHOROUGHSRC)) @@ -310,9 +310,9 @@ static int eat_range (pattern_t *pat, int flags, BUFFER *s, BUFFER *err) char *tmp; int do_exclusive = 0; int skip_quote = 0; - + /* - * If simple_search is set to "~m %s", the range will have double quotes + * If simple_search is set to "~m %s", the range will have double quotes * around it... */ if (*s->dptr == '"') @@ -361,7 +361,7 @@ static int eat_range (pattern_t *pat, int flags, BUFFER *s, BUFFER *err) s->dptr++; tmp = s->dptr; } - + if (isdigit ((unsigned char) *tmp)) { /* range maximum */ @@ -479,19 +479,19 @@ static void adjust_date_range (struct tm *min, struct tm *max) && min->tm_mday > max->tm_mday)) { int tmp; - + tmp = min->tm_year; min->tm_year = max->tm_year; max->tm_year = tmp; - + tmp = min->tm_mon; min->tm_mon = max->tm_mon; max->tm_mon = tmp; - + tmp = min->tm_mday; min->tm_mday = max->tm_mday; max->tm_mday = tmp; - + min->tm_hour = min->tm_min = min->tm_sec = 0; max->tm_hour = 23; max->tm_min = max->tm_sec = 59; @@ -501,7 +501,7 @@ static void adjust_date_range (struct tm *min, struct tm *max) static const char * parse_date_range (const char* pc, struct tm *min, struct tm *max, int haveMin, struct tm *baseMin, BUFFER *err) { - int flag = MUTT_PDR_NONE; + int flag = MUTT_PDR_NONE; while (*pc && ((flag & MUTT_PDR_DONE) == 0)) { const char *pt; @@ -1419,7 +1419,7 @@ mutt_pattern_exec (struct pattern_t *pat, pattern_exec_flag flags, CONTEXT *ctx, static void quote_simple(char *tmp, size_t len, const char *p) { int i = 0; - + tmp[i++] = '"'; while (*p && i < len - 3) { @@ -1430,7 +1430,7 @@ static void quote_simple(char *tmp, size_t len, const char *p) tmp[i++] = '"'; tmp[i] = 0; } - + /* convert a simple search into a real request */ void mutt_check_simple (char *s, size_t len, const char *simple) { @@ -1496,7 +1496,7 @@ int mutt_pattern_func (int op, char *prompt) return (-1); mutt_message _("Compiling search pattern..."); - + simple = safe_strdup (buf); mutt_check_simple (buf, sizeof (buf), NONULL (SimpleSearch)); @@ -1559,12 +1559,12 @@ int mutt_pattern_func (int op, char *prompt) mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_PURGE, 0); case MUTT_DELETE: - mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_DELETE, + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_DELETE, (op == MUTT_DELETE)); break; case MUTT_TAG: case MUTT_UNTAG: - mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_TAG, + mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], MUTT_TAG, (op == MUTT_TAG)); break; } @@ -1632,7 +1632,7 @@ int mutt_search_command (int cur, int op) else set_option (OPTSEARCHREVERSE); - /* compare the *expanded* version of the search pattern in case + /* compare the *expanded* version of the search pattern in case $simple_search has changed while we were searching */ strfcpy (temp, buf, sizeof (temp)); mutt_check_simple (temp, sizeof (temp), NONULL (SimpleSearch)); @@ -1685,7 +1685,7 @@ int mutt_search_command (int cur, int op) i = 0; if (option (OPTWRAPSEARCH)) msg = _("Search wrapped to top."); - else + else { mutt_message _("Search hit bottom without finding match"); return (-1); @@ -1696,7 +1696,7 @@ int mutt_search_command (int cur, int op) i = Context->vcount - 1; if (option (OPTWRAPSEARCH)) msg = _("Search wrapped to bottom."); - else + else { mutt_message _("Search hit top without finding match"); return (-1); diff --git a/pgp.c b/pgp.c index a23a89f1..73a6c79e 100644 --- a/pgp.c +++ b/pgp.c @@ -7,16 +7,16 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * This file contains all of the PGP routines necessary to sign, encrypt, @@ -85,7 +85,7 @@ int pgp_valid_passphrase (void) if (now < PgpExptime) /* Use cached copy. */ return 1; - + pgp_void_passphrase (); if (mutt_get_password (_("Enter PGP passphrase:"), PgpPass, sizeof (PgpPass)) == 0) @@ -197,7 +197,7 @@ static int pgp_copy_checksig (FILE *fpin, FILE *fpout) char *line = NULL; int lineno = 0; size_t linelen; - + while ((line = mutt_read_line (line, &linelen, fpin, &lineno, 0)) != NULL) { if (regexec (PgpGoodSign.rx, line, 0, NULL, 0) == 0) @@ -209,7 +209,7 @@ static int pgp_copy_checksig (FILE *fpin, FILE *fpout) else dprint (2, (debugfile, "pgp_copy_checksig: \"%s\" doesn't match regexp.\n", line)); - + if (strncmp (line, "[GNUPG:] ", 9) == 0) continue; fputs (line, fpout); @@ -334,26 +334,26 @@ static int pgp_check_decryption_okay (FILE *fpin) return rv; } -/* +/* * Copy a clearsigned message, and strip the signature and PGP's * dash-escaping. - * + * * XXX - charset handling: We assume that it is safe to do * character set decoding first, dash decoding second here, while * we do it the other way around in the main handler. - * + * * (Note that we aren't worse than Outlook &c in this, and also * note that we can successfully handle anything produced by any - * existing versions of mutt.) + * existing versions of mutt.) */ static void pgp_copy_clearsigned (FILE *fpin, STATE *s, char *charset) { char buf[HUGE_STRING]; short complete, armor_header; - + FGETCONV *fc; - + rewind (fpin); /* fromcode comes from the MIME Content-Type charset label. It might @@ -361,7 +361,7 @@ static void pgp_copy_clearsigned (FILE *fpin, STATE *s, char *charset) * charset-hooks. Therefore we set flags to MUTT_ICONV_HOOK_FROM. */ fc = fgetconv_open (fpin, charset, Charset, MUTT_ICONV_HOOK_FROM); - + for (complete = 1, armor_header = 1; fgetconvs (buf, sizeof (buf), fc) != NULL; complete = strchr (buf, '\n') != NULL) @@ -375,24 +375,24 @@ static void pgp_copy_clearsigned (FILE *fpin, STATE *s, char *charset) if (mutt_strcmp (buf, "-----BEGIN PGP SIGNATURE-----\n") == 0) break; - + if (armor_header) { char *p = mutt_skip_whitespace (buf); - if (*p == '\0') + if (*p == '\0') armor_header = 0; continue; } - - if (s->prefix) + + if (s->prefix) state_puts (s->prefix, s); - + if (buf[0] == '-' && buf[1] == ' ') state_puts (buf + 2, s); else state_puts (buf, s); } - + fgetconv_close (&fc); } @@ -426,16 +426,16 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) fseeko (s->fpin, m->offset, 0); last_pos = m->offset; - + for (bytes = m->length; bytes > 0;) { if (fgets (buf, sizeof (buf), s->fpin) == NULL) break; - + offset = ftello (s->fpin); bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; - + if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0) { clearsign = 0; @@ -453,7 +453,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) { needpass = 0; pgp_keyblock = 1; - } + } else { /* XXX - we may wish to recode here */ @@ -472,18 +472,18 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) mutt_perror (tmpfname); return -1; } - + fputs (buf, tmpfp); while (bytes > 0 && fgets (buf, sizeof (buf) - 1, s->fpin) != NULL) { offset = ftello (s->fpin); bytes -= (offset - last_pos); /* don't rely on mutt_strlen(buf) */ last_pos = offset; - + fputs (buf, tmpfp); if ((needpass && mutt_strcmp ("-----END PGP MESSAGE-----\n", buf) == 0) || - (!needpass + (!needpass && (mutt_strcmp ("-----END PGP SIGNATURE-----\n", buf) == 0 || mutt_strcmp ("-----END PGP PUBLIC KEY BLOCK-----\n",buf) == 0))) break; @@ -576,13 +576,13 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) * gpg_good_sign="" && pgp_decode_command returned 0 */ if (rc == -1 || rv) maybe_goodsig = 0; - + state_attach_puts (_("[-- End of PGP output --]\n\n"), s); } if (pgp_use_gpg_agent()) mutt_need_hard_redraw (); } - + /* treat empty result as sign of failure */ /* TODO: maybe on failure mutt should include the original undecoded text. */ if (pgpout) @@ -596,7 +596,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) could_not_decrypt = 1; pgp_void_passphrase (); } - + if ((could_not_decrypt || (decrypt_okay_rc <= -3)) && !(s->flags & MUTT_DISPLAY)) { @@ -606,7 +606,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) goto out; } } - + /* * Now, copy cleartext to the screen. */ @@ -624,7 +624,7 @@ int pgp_application_pgp_handler (BODY *m, STATE *s) if (clearsign) { rewind (tmpfp); - if (tmpfp) + if (tmpfp) pgp_copy_clearsigned (tmpfp, s, body_charset); } else if (pgpout) @@ -706,7 +706,7 @@ out: state_attach_puts (_("[-- Error: could not find beginning of PGP message! --]\n\n"), s); return -1; } - + return rc; } @@ -715,11 +715,11 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b) char tempfile[_POSIX_PATH_MAX]; char buf[HUGE_STRING]; FILE *tfp; - + short sgn = 0; short enc = 0; short key = 0; - + if (b->type != TYPETEXT) return 0; @@ -729,13 +729,13 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b) unlink (tempfile); return 0; } - + if ((tfp = fopen (tempfile, "r")) == NULL) { unlink (tempfile); return 0; } - + while (fgets (buf, sizeof (buf), tfp)) { if (mutt_strncmp ("-----BEGIN PGP ", buf, 15) == 0) @@ -755,7 +755,7 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b) return 0; /* fix the content type */ - + mutt_set_parameter ("format", "fixed", &b->parameter); if (enc) mutt_set_parameter ("x-action", "pgp-encrypted", &b->parameter); @@ -763,7 +763,7 @@ static int pgp_check_traditional_one_body (FILE *fp, BODY *b) mutt_set_parameter ("x-action", "pgp-signed", &b->parameter); else if (key) mutt_set_parameter ("x-action", "pgp-keys", &b->parameter); - + return 1; } @@ -790,7 +790,7 @@ int pgp_check_traditional (FILE *fp, BODY *b, int just_one) return rv; } - + @@ -801,19 +801,19 @@ int pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) pid_t thepid; int badsig = -1; int rv; - + snprintf (sigfile, sizeof (sigfile), "%s.asc", tempfile); - + if(!(fp = safe_fopen (sigfile, "w"))) { mutt_perror(sigfile); return -1; } - + fseeko (s->fpin, sigbdy->offset, 0); mutt_copy_bytes (s->fpin, fp, sigbdy->length); safe_fclose (&fp); - + mutt_mktemp (pgperrfile, sizeof (pgperrfile)); if(!(pgperr = safe_fopen(pgperrfile, "w+"))) { @@ -821,27 +821,27 @@ int pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) unlink(sigfile); return -1; } - + crypt_current_time (s, "PGP"); - - if((thepid = pgp_invoke_verify (NULL, &pgpout, NULL, + + if((thepid = pgp_invoke_verify (NULL, &pgpout, NULL, -1, -1, fileno(pgperr), tempfile, sigfile)) != -1) { if (pgp_copy_checksig (pgpout, s->fpout) >= 0) badsig = 0; - - + + safe_fclose (&pgpout); fflush (pgperr); rewind (pgperr); - + if (pgp_copy_checksig (pgperr, s->fpout) >= 0) badsig = 0; if ((rv = mutt_wait_filter (thepid))) badsig = -1; - + dprint (1, (debugfile, "pgp_verify_one: mutt_wait_filter returned %d.\n", rv)); } @@ -853,7 +853,7 @@ int pgp_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) mutt_unlink (pgperrfile); dprint (1, (debugfile, "pgp_verify_one: returning %d.\n", badsig)); - + return badsig; } @@ -874,10 +874,10 @@ static void pgp_extract_keys_from_attachment (FILE *fp, BODY *top) } memset (&s, 0, sizeof (STATE)); - + s.fpin = fp; s.fpout = tempfp; - + mutt_body_handler (top, &s); safe_fclose (&tempfp); @@ -898,16 +898,16 @@ void pgp_extract_keys_from_attachment_list (FILE *fp, int tag, BODY *top) mutt_endwin (NULL); set_option(OPTDONTHANDLEPGPKEYS); - + for(; top; top = top->next) { if(!tag || top->tagged) pgp_extract_keys_from_attachment (fp, top); - + if(!tag) break; } - + unset_option(OPTDONTHANDLEPGPKEYS); } @@ -922,7 +922,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p) char pgptmpfile[_POSIX_PATH_MAX]; pid_t thepid; int rv; - + mutt_mktemp (pgperrfile, sizeof (pgperrfile)); if ((pgperr = safe_fopen (pgperrfile, "w+")) == NULL) { @@ -964,7 +964,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p) fputs (PgpPass, pgpin); fputc ('\n', pgpin); safe_fclose (&pgpin); - + /* Read the output from PGP, and make sure to change CRLF to LF, otherwise * read_mime_header has a hard time parsing the message. */ @@ -1014,7 +1014,7 @@ BODY *pgp_decrypt_part (BODY *a, STATE *s, FILE *fpout, BODY *p) } rewind (fpout); - + if ((tattach = mutt_read_mime_header (fpout, 0)) != NULL) { /* @@ -1168,16 +1168,16 @@ int pgp_encrypted_handler (BODY *a, STATE *s) tattach->parts->mime_headers = NULL; } - /* + /* * if a multipart/signed is the _only_ sub-part of a * multipart/encrypted, cache signature verification * status. * */ - + if (mutt_is_multipart_signed (tattach) && !tattach->next) a->goodsig |= tattach->goodsig; - + if (s->flags & MUTT_DISPLAY) { state_puts ("\n", s); @@ -1217,7 +1217,7 @@ BODY *pgp_sign_message (BODY *a) int err = 0; int empty = 1; pid_t thepid; - + convert_to_7bit (a); /* Signed data _must_ be in 7-bit format. */ mutt_mktemp (sigfile, sizeof (sigfile)); @@ -1234,12 +1234,12 @@ BODY *pgp_sign_message (BODY *a) unlink(sigfile); return NULL; } - + mutt_write_mime_header (a, sfp); fputc ('\n', sfp); mutt_write_mime_body (a, sfp); safe_fclose (&sfp); - + if ((thepid = pgp_invoke_sign (&pgpin, &pgpout, &pgperr, -1, -1, -1, signedfile)) == -1) { @@ -1249,12 +1249,12 @@ BODY *pgp_sign_message (BODY *a) unlink(signedfile); return NULL; } - + if (!pgp_use_gpg_agent()) fputs(PgpPass, pgpin); fputc('\n', pgpin); safe_fclose (&pgpin); - + /* * Read back the PGP signature. Also, change MESSAGE=>SIGNATURE as * recommended for future releases of PGP. @@ -1284,7 +1284,7 @@ BODY *pgp_sign_message (BODY *a) safe_fclose (&pgperr); safe_fclose (&pgpout); unlink (signedfile); - + if (fclose (fp) != 0) { mutt_perror ("fclose"); @@ -1464,7 +1464,7 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) int err = 0; int empty = 0; pid_t thepid; - + mutt_mktemp (tempfile, sizeof (tempfile)); if ((fpout = safe_fopen (tempfile, "w+")) == NULL) { @@ -1491,16 +1491,16 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) safe_fclose (&pgperr); return NULL; } - + if (sign) convert_to_7bit (a); - + mutt_write_mime_header (a, fptmp); fputc ('\n', fptmp); mutt_write_mime_body (a, fptmp); safe_fclose (&fptmp); - - if ((thepid = pgp_invoke_encrypt (&pgpin, NULL, NULL, -1, + + if ((thepid = pgp_invoke_encrypt (&pgpin, NULL, NULL, -1, fileno (fpout), fileno (pgperr), pgpinfile, keylist, sign)) == -1) { @@ -1516,12 +1516,12 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) fputc ('\n', pgpin); } safe_fclose (&pgpin); - + if(mutt_wait_filter (thepid) && option(OPTPGPCHECKEXIT)) empty=1; unlink(pgpinfile); - + fflush (fpout); rewind (fpout); if(!empty) @@ -1559,7 +1559,7 @@ BODY *pgp_encrypt_message (BODY *a, char *keylist, int sign) mutt_generate_boundary(&t->parameter); mutt_set_parameter("protocol", "application/pgp-encrypted", &t->parameter); - + t->parts = mutt_new_body (); t->parts->type = TYPEAPPLICATION; t->parts->subtype = safe_strdup ("pgp-encrypted"); @@ -1585,11 +1585,11 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) char pgpoutfile[_POSIX_PATH_MAX]; char pgperrfile[_POSIX_PATH_MAX]; char pgpinfile[_POSIX_PATH_MAX]; - + char body_charset[STRING]; char *from_charset; const char *send_charset; - + FILE *pgpout = NULL, *pgperr = NULL, *pgpin = NULL; FILE *fp; @@ -1604,13 +1604,13 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) return NULL; if (ascii_strcasecmp (a->subtype, "plain")) return NULL; - + if ((fp = fopen (a->filename, "r")) == NULL) { mutt_perror (a->filename); return NULL; } - + mutt_mktemp (pgpinfile, sizeof (pgpinfile)); if ((pgpin = safe_fopen (pgpinfile, "w")) == NULL) { @@ -1624,18 +1624,18 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) * we have to convert from that to utf-8. If noconv is not set, * we have to convert from $charset to utf-8. */ - + mutt_get_body_charset (body_charset, sizeof (body_charset), a); if (a->noconv) from_charset = body_charset; - else + else from_charset = Charset; - + if (!mutt_is_us_ascii (body_charset)) { int c; FGETCONV *fc; - + if (flags & ENCRYPT) send_charset = "us-ascii"; else @@ -1645,7 +1645,7 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) fc = fgetconv_open (fp, from_charset, "utf-8", 0); while ((c = fgetconv (fc)) != EOF) fputc (c, pgpin); - + fgetconv_close (&fc); } else @@ -1663,17 +1663,17 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) { mutt_perror (pgpout ? pgperrfile : pgpoutfile); unlink (pgpinfile); - if (pgpout) + if (pgpout) { safe_fclose (&pgpout); unlink (pgpoutfile); } return NULL; } - + unlink (pgperrfile); - if ((thepid = pgp_invoke_traditional (&pgpin, NULL, NULL, + if ((thepid = pgp_invoke_traditional (&pgpin, NULL, NULL, -1, fileno (pgpout), fileno (pgperr), pgpinfile, keylist, flags)) == -1) { @@ -1701,24 +1701,24 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) rewind (pgpout); rewind (pgperr); - + if(!empty) empty = (fgetc (pgpout) == EOF); safe_fclose (&pgpout); - + err = 0; - + while (fgets (buff, sizeof (buff), pgperr)) { err = 1; fputs (buff, stdout); } - + safe_fclose (&pgperr); - + if (err) mutt_any_key_to_continue (NULL); - + if (empty) { if (flags & SIGN) @@ -1726,29 +1726,29 @@ BODY *pgp_traditional_encryptsign (BODY *a, int flags, char *keylist) unlink (pgpoutfile); return NULL; } - + b = mutt_new_body (); - + b->encoding = ENC7BIT; b->type = TYPETEXT; b->subtype = safe_strdup ("plain"); - + mutt_set_parameter ("x-action", flags & ENCRYPT ? "pgp-encrypted" : "pgp-signed", &b->parameter); mutt_set_parameter ("charset", send_charset, &b->parameter); - + b->filename = safe_strdup (pgpoutfile); - + b->disposition = DISPNONE; b->unlink = 1; b->noconv = 1; b->use_disp = 0; - + if (!(flags & ENCRYPT)) b->encoding = a->encoding; - + return b; } @@ -1764,7 +1764,7 @@ int pgp_send_menu (HEADER *msg) return msg->security; /* If autoinline and no crypto options set, then set inline. */ - if (option (OPTPGPAUTOINLINE) && + if (option (OPTPGPAUTOINLINE) && !((msg->security & APPLICATION_PGP) && (msg->security & (SIGN|ENCRYPT)))) msg->security |= INLINE; @@ -1810,7 +1810,7 @@ int pgp_send_menu (HEADER *msg) if (msg->security & (ENCRYPT | SIGN)) { - snprintf (promptbuf, sizeof (promptbuf), + snprintf (promptbuf, sizeof (promptbuf), _("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, (c)lear, or (o)ppenc mode? "), (msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline")); prompt = promptbuf; @@ -1832,7 +1832,7 @@ int pgp_send_menu (HEADER *msg) if (msg->security & (ENCRYPT | SIGN)) { - snprintf (promptbuf, sizeof (promptbuf), + snprintf (promptbuf, sizeof (promptbuf), _("PGP (e)ncrypt, (s)ign, sign (a)s, (b)oth, %s format, or (c)lear? "), (msg->security & INLINE) ? _("PGP/M(i)ME") : _("(i)nline")); prompt = promptbuf; diff --git a/pgp.h b/pgp.h index 05fc6b00..32076ff8 100644 --- a/pgp.h +++ b/pgp.h @@ -7,12 +7,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -66,28 +66,28 @@ int pgp_valid_passphrase (void); /* The PGP invocation interface - not really beautiful. */ pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, short need_passphrase); pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *sig_fname); pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname); pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname); pid_t pgp_invoke_encrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *uids, int sign); pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids); pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids); pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, pgp_ring_t keyring, LIST *hints); pid_t pgp_invoke_traditional (FILE **pgpin, FILE **pgpout, FILE **pgperr, int pgpinfd, int pgpoutfd, int pgperrfd, diff --git a/pgpinvoke.c b/pgpinvoke.c index e7f1e97e..4671b1b4 100644 --- a/pgpinvoke.c +++ b/pgpinvoke.c @@ -1,23 +1,23 @@ /* * Copyright (C) 1997-2003 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ /* This file contains the new pgp invocation code. Note that this * is almost entirely format based. @@ -71,7 +71,7 @@ const char *_mutt_fmt_pgp_command (char *dest, char fmt[16]; struct pgp_command_context *cctx = (struct pgp_command_context *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); - + switch (op) { case 'r': @@ -85,7 +85,7 @@ const char *_mutt_fmt_pgp_command (char *dest, optional = 0; break; } - + case 'a': { if (!optional) @@ -97,7 +97,7 @@ const char *_mutt_fmt_pgp_command (char *dest, optional = 0; break; } - + case 's': { if (!optional) @@ -109,7 +109,7 @@ const char *_mutt_fmt_pgp_command (char *dest, optional = 0; break; } - + case 'f': { if (!optional) @@ -121,7 +121,7 @@ const char *_mutt_fmt_pgp_command (char *dest, optional = 0; break; } - + case 'p': { if (!optional) @@ -169,12 +169,12 @@ static pid_t pgp_invoke (FILE **pgpin, FILE **pgpout, FILE **pgperr, { struct pgp_command_context cctx; char cmd[HUGE_STRING]; - + memset (&cctx, 0, sizeof (cctx)); if (!format || !*format) return (pid_t) -1; - + cctx.need_passphrase = need_passphrase; cctx.fname = fname; cctx.sig_fname = sig_fname; @@ -183,9 +183,9 @@ static pid_t pgp_invoke (FILE **pgpin, FILE **pgpout, FILE **pgperr, else cctx.signas = PgpDefaultKey; cctx.ids = ids; - + mutt_pgp_command (cmd, sizeof (cmd), &cctx, format); - + return mutt_create_filter_fd (cmd, pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd); } @@ -193,13 +193,13 @@ static pid_t pgp_invoke (FILE **pgpin, FILE **pgpout, FILE **pgperr, /* * The exported interface. - * + * * This is historic and may be removed at some point. * */ pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, short need_passphrase) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -208,7 +208,7 @@ pid_t pgp_invoke_decode (FILE **pgpin, FILE **pgpout, FILE **pgperr, } pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname, const char *sig_fname) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -216,7 +216,7 @@ pid_t pgp_invoke_verify (FILE **pgpin, FILE **pgpout, FILE **pgperr, } pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -224,7 +224,7 @@ pid_t pgp_invoke_decrypt (FILE **pgpin, FILE **pgpout, FILE **pgperr, } pid_t pgp_invoke_sign (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *fname) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -266,16 +266,16 @@ void pgp_invoke_import (const char *fname) char _fname[_POSIX_PATH_MAX + SHORT_STRING]; char cmd[HUGE_STRING]; struct pgp_command_context cctx; - + memset (&cctx, 0, sizeof (cctx)); - + mutt_quote_filename (_fname, sizeof (_fname), fname); cctx.fname = _fname; if (PgpSignAs && *PgpSignAs) cctx.signas = PgpSignAs; else cctx.signas = PgpDefaultKey; - + mutt_pgp_command (cmd, sizeof (cmd), &cctx, PgpImportCommand); mutt_system (cmd); } @@ -288,25 +288,25 @@ void pgp_invoke_getkeys (ADDRESS *addr) int devnull; char *personal; - + struct pgp_command_context cctx; if (!PgpGetkeysCommand) return; - + memset (&cctx, 0, sizeof (cctx)); personal = addr->personal; addr->personal = NULL; - + *tmp = '\0'; mutt_addrlist_to_local (addr); rfc822_write_address_single (tmp, sizeof (tmp), addr, 0); mutt_quote_filename (buff, sizeof (buff), tmp); addr->personal = personal; - + cctx.ids = buff; - + mutt_pgp_command (cmd, sizeof (cmd), &cctx, PgpGetkeysCommand); devnull = open ("/dev/null", O_RDWR); @@ -321,7 +321,7 @@ void pgp_invoke_getkeys (ADDRESS *addr) } pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -330,7 +330,7 @@ pid_t pgp_invoke_export (FILE **pgpin, FILE **pgpout, FILE **pgperr, } pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, const char *uids) { return pgp_invoke (pgpin, pgpout, pgperr, pgpinfd, pgpoutfd, pgperrfd, @@ -339,7 +339,7 @@ pid_t pgp_invoke_verify_key (FILE **pgpin, FILE **pgpout, FILE **pgperr, } pid_t pgp_invoke_list_keys (FILE **pgpin, FILE **pgpout, FILE **pgperr, - int pgpinfd, int pgpoutfd, int pgperrfd, + int pgpinfd, int pgpoutfd, int pgperrfd, pgp_ring_t keyring, LIST *hints) { BUFFER *uids; diff --git a/pgpkey.c b/pgpkey.c index cfbc6ba7..e497508d 100644 --- a/pgpkey.c +++ b/pgpkey.c @@ -1,19 +1,19 @@ /* * Copyright (C) 1996-1997,2007 Michael R. Elkins * Copyright (c) 1998-2003 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -87,7 +87,7 @@ static char pgp_flags (int flags) return 'd'; else if (flags & KEYFLAG_CRITICAL) return 'c'; - else + else return ' '; } @@ -101,7 +101,7 @@ static pgp_key_t pgp_principal_key (pgp_key_t key) /* * Format an entry on the PGP key selection menu. - * + * * %n number * %k key id %K key id of the principal key * %u user id @@ -292,7 +292,7 @@ static void pgp_entry (char *s, size_t l, MUTTMENU * menu, int num) entry.uid = KeyTable[num]; entry.num = num + 1; - mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), pgp_entry_fmt, + mutt_FormatString (s, l, 0, MuttIndexWindow->cols, NONULL (PgpEntryFormat), pgp_entry_fmt, (unsigned long) &entry, MUTT_FORMAT_ARROWCURSOR); } @@ -325,7 +325,7 @@ static int _pgp_compare_keyid (const void *a, const void *b) pgp_uid_t **s = (pgp_uid_t **) a; pgp_uid_t **t = (pgp_uid_t **) b; - if ((r = mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent), + if ((r = mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent), pgp_fpr_or_lkeyid ((*t)->parent)))) return r > 0; else @@ -373,7 +373,7 @@ static int _pgp_compare_trust (const void *a, const void *b) return r < 0; if ((r = mutt_strcasecmp ((*s)->addr, (*t)->addr))) return r > 0; - return (mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent), + return (mutt_strcasecmp (pgp_fpr_or_lkeyid ((*s)->parent), pgp_fpr_or_lkeyid ((*t)->parent))) > 0; } @@ -579,7 +579,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, safe_fclose (&fp); safe_fclose (&devnull); mutt_clear_error (); - snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"), + snprintf (cmd, sizeof (cmd), _("Key ID: 0x%s"), pgp_keyid (pgp_principal_key (KeyTable[menu->current]->parent))); mutt_do_pager (cmd, tempfile, 0, NULL); menu->redraw = REDRAW_FULL; @@ -609,7 +609,7 @@ static pgp_key_t pgp_select_key (pgp_key_t keys, { char *s = ""; char buff[LONG_STRING]; - + if (KeyTable[menu->current]->flags & KEYFLAG_CANTUSE) s = N_("ID is expired/disabled/revoked."); else switch (KeyTable[menu->current]->trust & 0x03) @@ -753,7 +753,7 @@ BODY *pgp_make_key_attachment (char *tempf) mutt_message _("Invoking PGP..."); - if ((thepid = + if ((thepid = pgp_invoke_export (NULL, NULL, NULL, -1, fileno (tempfp), fileno (devnull), tmp)) == -1) { @@ -924,15 +924,15 @@ pgp_key_t pgp_getkeybyaddr (ADDRESS * a, short abilities, pgp_ring_t keyring, { /* * There was precisely one strong match on a valid ID. - * + * * Proceed without asking the user. */ pgp_remove_key (&matches, the_strong_valid_key); k = the_strong_valid_key; } - else + else { - /* + /* * Else: Ask the user. */ if ((k = pgp_select_key (matches, a, NULL))) diff --git a/pgplib.c b/pgplib.c index 93f8b06e..512d8a52 100644 --- a/pgplib.c +++ b/pgplib.c @@ -1,18 +1,18 @@ /* * Copyright (C) 1997-2002 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -109,7 +109,7 @@ short pgp_cansign (unsigned char type) } } -/* return values: +/* return values: * 1 = sign only * 2 = encrypt only @@ -124,16 +124,16 @@ short pgp_get_abilities (unsigned char type) void pgp_free_sig (pgp_sig_t **sigp) { pgp_sig_t *sp, *q; - + if (!sigp || !*sigp) return; - + for (sp = *sigp; sp; sp = q) { q = sp->next; FREE (&sp); } - + *sigp = NULL; } @@ -225,7 +225,7 @@ void pgp_free_key (pgp_key_t *kpp) if ((*kpp)->parent && (*kpp)->parent != *kpp) *kpp = (*kpp)->parent; - + /* Order is important here: * * - First free all children. @@ -249,4 +249,3 @@ void pgp_free_key (pgp_key_t *kpp) *kpp = NULL; } - diff --git a/pgplib.h b/pgplib.h index 02334169..a4b88544 100644 --- a/pgplib.h +++ b/pgplib.h @@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/pgpmicalg.c b/pgpmicalg.c index c1ec37f5..51884571 100644 --- a/pgpmicalg.c +++ b/pgpmicalg.c @@ -1,16 +1,16 @@ /* * Copyright (C) 2001 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, @@ -35,12 +35,12 @@ #include #include -static const struct +static const struct { short id; const char *name; -} -HashAlgorithms[] = +} +HashAlgorithms[] = { { 1, "pgp-md5" }, { 2, "pgp-sha1" }, @@ -58,7 +58,7 @@ HashAlgorithms[] = static const char *pgp_hash_to_micalg (short id) { int i; - + for (i = 0; HashAlgorithms[i].id >= 0; i++) if (HashAlgorithms[i].id == id) return HashAlgorithms[i].name; @@ -73,13 +73,13 @@ static void pgp_dearmor (FILE *in, FILE *out) char *r; STATE state; - + memset (&state, 0, sizeof (STATE)); state.fpin = in; state.fpout = out; - + /* find the beginning of ASCII armor */ - + while ((r = fgets (line, sizeof (line), in)) != NULL) { if (!strncmp (line, "-----BEGIN", 10)) @@ -92,7 +92,7 @@ static void pgp_dearmor (FILE *in, FILE *out) } /* skip the armor header */ - + while ((r = fgets (line, sizeof (line), in)) != NULL) { SKIPWS (r); @@ -103,12 +103,12 @@ static void pgp_dearmor (FILE *in, FILE *out) dprint (1, (debugfile, "pgp_dearmor: Armor header doesn't end.\n")); return; } - + /* actual data starts here */ start = ftello (in); - + /* find the checksum */ - + while ((r = fgets (line, sizeof (line), in)) != NULL) { if (*line == '=' || !strncmp (line, "-----END", 8)) @@ -119,13 +119,13 @@ static void pgp_dearmor (FILE *in, FILE *out) dprint (1, (debugfile, "pgp_dearmor: Can't find end of ASCII armor.\n")); return; } - + if ((end = ftello (in) - strlen (line)) < start) { dprint (1, (debugfile, "pgp_dearmor: end < start???\n")); return; } - + if (fseeko (in, start, SEEK_SET) == -1) { dprint (1, (debugfile, "pgp_dearmor: Can't seekto start.\n")); @@ -144,7 +144,7 @@ static short pgp_mic_from_packet (unsigned char *p, size_t len) p[0]&0x3f, PT_SIG)); return -1; } - + if (len >= 18 && p[1] == 3) /* version 3 signature */ return (short) p[17]; @@ -162,14 +162,14 @@ static short pgp_find_hash (const char *fname) { FILE *in = NULL; FILE *out = NULL; - + char tempfile[_POSIX_PATH_MAX]; - + unsigned char *p; size_t l; - + short rv = -1; - + mutt_mktemp (tempfile, sizeof (tempfile)); if ((out = safe_fopen (tempfile, "w+")) == NULL) { @@ -177,13 +177,13 @@ static short pgp_find_hash (const char *fname) goto bye; } unlink (tempfile); - + if ((in = fopen (fname, "r")) == NULL) { mutt_perror (fname); goto bye; } - + pgp_dearmor (in, out); rewind (out); @@ -195,9 +195,9 @@ static short pgp_find_hash (const char *fname) { dprint (1, (debugfile, "pgp_find_hash: No packet.\n")); } - + bye: - + safe_fclose (&in); safe_fclose (&out); pgp_release_packet (); @@ -208,4 +208,3 @@ const char *pgp_micalg (const char *fname) { return pgp_hash_to_micalg (pgp_find_hash (fname)); } - diff --git a/pgppacket.c b/pgppacket.c index 50593871..a77f53e7 100644 --- a/pgppacket.c +++ b/pgppacket.c @@ -1,16 +1,16 @@ /* * Copyright (C) 2001-2002,2007 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, @@ -228,4 +228,3 @@ void pgp_release_packet (void) plen = 0; FREE (&pbuf); } - diff --git a/pgppacket.h b/pgppacket.h index 6af1ddc9..bf9c48f7 100644 --- a/pgppacket.h +++ b/pgppacket.h @@ -1,23 +1,23 @@ /* * Copyright (C) 2001 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as * published by the Free Software Foundation; either version 2 of * the License, or (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. */ -/* +/* * Definitions for a rudimentary PGP packet parser which is shared * by mutt proper and the PGP public key ring lister. */ diff --git a/pgppubring.c b/pgppubring.c index b045518f..879df12f 100644 --- a/pgppubring.c +++ b/pgppubring.c @@ -1,18 +1,18 @@ /* * Copyright (C) 1997-2003 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -21,14 +21,14 @@ /* * This is a "simple" PGP key ring dumper. - * + * * The output format is supposed to be compatible to the one GnuPG * emits and Mutt expects. - * + * * Note that the code of this program could be considerably less * complex, but most of it was taken from mutt's second generation * key ring parser. - * + * * You can actually use this to put together some fairly general * PGP key management applications. * @@ -78,10 +78,10 @@ static void pgpring_dump_keyblock (pgp_key_t p); int main (int argc, char * const argv[]) { int c; - + short version = 2; short secring = 0; - + const char *_kring = NULL; char *env_pgppath, *env_home; @@ -109,19 +109,19 @@ int main (int argc, char * const argv[]) _kring = optarg; break; } - + case '2': case '5': { version = c - '0'; break; } - + case 's': { secring = 1; break; } - + default: { fprintf (stderr, "usage: %s [-k | [-2 | -5] [ -s] [-S] [-f]] [hints]\n", @@ -144,15 +144,15 @@ int main (int argc, char * const argv[]) fprintf (stderr, "%s: Can't determine your PGPPATH.\n", argv[0]); exit (1); } - + if (secring) snprintf (kring, sizeof (kring), "%s/secring.%s", pgppath, version == 2 ? "pgp" : "skr"); else snprintf (kring, sizeof (kring), "%s/pubring.%s", pgppath, version == 2 ? "pgp" : "pkr"); } - + pgpring_find_candidates (kring, (const char**) argv + optind, argc - optind); - + return 0; } @@ -241,7 +241,7 @@ static pgp_key_t pgp_parse_pgp2_key (unsigned char *buff, size_t l) pgp_make_pgp2_fingerprint (&buff[j], digest); p->fingerprint = binary_fingerprint_to_string (digest, MD5_DIGEST_LENGTH); } - + expl = 0; for (i = 0; i < 2; i++) expl = (expl << 8) + buff[j++]; @@ -356,7 +356,7 @@ static pgp_key_t pgp_parse_pgp3_key (unsigned char *buff, size_t l) { p->fingerprint = binary_fingerprint_to_string (digest, SHA_DIGEST_LENGTH); } - + for (k = 0; k < 2; k++) { for (id = 0, i = SHA_DIGEST_LENGTH - 8 + k * 4; @@ -415,7 +415,7 @@ static int pgp_parse_pgp2_sig (unsigned char *buff, size_t l, for (i = 0; i < 4; i++) signerid2 = (signerid2 << 8) + buff[j++]; - + if (sigtype == 0x20 || sigtype == 0x28) p->flags |= KEYFLAG_REVOKED; @@ -425,7 +425,7 @@ static int pgp_parse_pgp2_sig (unsigned char *buff, size_t l, s->sid1 = signerid1; s->sid2 = signerid2; } - + return 0; } @@ -525,7 +525,7 @@ static int pgp_parse_pgp3_sig (unsigned char *buff, size_t l, signerid1 = (signerid1 << 8) + buff[j++]; for (i = 0; i < 4; i++) signerid2 = (signerid2 << 8) + buff[j++]; - + break; } case 10: /* CMR key */ @@ -565,7 +565,7 @@ static int pgp_parse_pgp3_sig (unsigned char *buff, size_t l, s->sid2 = signerid2; } - + return 0; } @@ -581,7 +581,7 @@ static int pgp_parse_sig (unsigned char *buff, size_t l, { case 2: case 3: - return pgp_parse_pgp2_sig (buff, l, p, sig); + return pgp_parse_pgp2_sig (buff, l, p, sig); case 4: return pgp_parse_pgp3_sig (buff, l, p, sig); default: @@ -613,20 +613,20 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) pgp_sig_t **lsig = NULL; FGETPOS(fp,pos); - + while (!err && (buff = pgp_read_packet (fp, &l)) != NULL) { last_pt = pt; pt = buff[0] & 0x3f; /* check if we have read the complete key block. */ - + if ((pt == PT_SECKEY || pt == PT_PUBKEY) && root) { FSETPOS(fp, pos); return root; } - + switch (pt) { case PT_SECKEY: @@ -643,7 +643,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) last = &p->next; addr = &p->address; lsig = &p->sigs; - + if (pt == PT_SUBKEY || pt == PT_SUBSECKEY) { p->flags |= KEYFLAG_SUBKEY; @@ -654,7 +654,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) while (*addr) addr = &(*addr)->next; } } - + if (pt == PT_SECKEY || pt == PT_SUBSECKEY) p->flags |= KEYFLAG_SECRET; @@ -668,7 +668,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) pgp_sig_t *signature = safe_calloc (sizeof (pgp_sig_t), 1); *lsig = signature; lsig = &signature->next; - + pgp_parse_sig (buff, l, p, signature); } break; @@ -709,7 +709,7 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) uid->trust = 0; addr = &uid->next; lsig = &uid->sigs; - + /* the following tags are generated by * pgp 2.6.3in. */ @@ -728,8 +728,8 @@ static pgp_key_t pgp_parse_keyblock (FILE * fp) if (err) pgp_free_key (&root); - - return root; + + return root; } static int pgpring_string_matches_hint (const char *s, const char *hints[], int nhints) @@ -748,7 +748,7 @@ static int pgpring_string_matches_hint (const char *s, const char *hints[], int return 0; } -/* +/* * Go through the key ring file and look for keys with * matching IDs. */ @@ -767,7 +767,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh size_t l = 0; short err = 0; - + if ((rfp = fopen (ringfile, "r")) == NULL) { char *error_buf; @@ -787,10 +787,10 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh while (!err && (buff = pgp_read_packet (rfp, &l)) != NULL) { pt = buff[0] & 0x3f; - + if (l < 1) continue; - + if ((pt == PT_SECKEY) || (pt == PT_PUBKEY)) { keypos = pos; @@ -814,7 +814,7 @@ static void pgpring_find_candidates (char *ringfile, const char *hints[], int nh if ((p = pgp_parse_keyblock (rfp)) == NULL) err = 1; - + pgpring_dump_keyblock (p); pgp_free_key (&p); } @@ -840,7 +840,7 @@ static void print_userid (const char *id) } } -static void print_fingerprint (pgp_key_t p) +static void print_fingerprint (pgp_key_t p) { if (!p->fingerprint) return; @@ -881,7 +881,7 @@ static void pgpring_dump_keyblock (pgp_key_t p) short first; struct tm *tp; time_t t; - + for (; p; p = p->next) { first = 1; @@ -893,14 +893,14 @@ static void pgpring_dump_keyblock (pgp_key_t p) else printf ("sec:"); } - else + else { if (p->flags & KEYFLAG_SUBKEY) printf ("sub:"); else printf ("pub:"); } - + if (p->flags & KEYFLAG_REVOKED) putchar ('r'); if (p->flags & KEYFLAG_EXPIRED) @@ -928,7 +928,7 @@ static void pgpring_dump_keyblock (pgp_key_t p) printf (":%d:%d:%s:%04d-%02d-%02d::::", p->keylen, p->numalg, p->keyid, 1900 + tp->tm_year, tp->tm_mon + 1, tp->tm_mday); - + print_userid (uid->addr); printf ("::"); @@ -940,10 +940,10 @@ static void pgpring_dump_keyblock (pgp_key_t p) putchar ('D'); printf (":\n"); - if (dump_fingerprints) + if (dump_fingerprints) print_fingerprint (p); } - + if (dump_signatures) { if (first) pgpring_dump_signatures (p->sigs); diff --git a/pop.c b/pop.c index 99605195..b3d187b0 100644 --- a/pop.c +++ b/pop.c @@ -1,21 +1,21 @@ /* * Copyright (C) 2000-2002 Vsevolod Volkov * Copyright (C) 2006-2007,2009 Rocco Rutte - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -567,7 +567,7 @@ static int pop_fetch_message (CONTEXT* ctx, MESSAGE* msg, int msgno) msg->fp = fopen (cache->path, "r"); if (msg->fp) return 0; - + mutt_perror (cache->path); mutt_sleep (2); return -1; diff --git a/pop.h b/pop.h index 55e99eec..26cefb57 100644 --- a/pop.h +++ b/pop.h @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2003 Vsevolod Volkov - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _POP_H #define _POP_H 1 diff --git a/pop_auth.c b/pop_auth.c index 2d50fed5..945c9454 100644 --- a/pop_auth.c +++ b/pop_auth.c @@ -1,16 +1,16 @@ /* * Copyright (C) 2000-2001 Vsevolod Volkov - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -295,7 +295,7 @@ static pop_auth_res_t pop_auth_user (POP_DATA *pop_data, const char *method) if (ret == 0) { snprintf (buf, sizeof (buf), "PASS %s\r\n", pop_data->conn->account.pass); - ret = pop_query_d (pop_data, buf, sizeof (buf), + ret = pop_query_d (pop_data, buf, sizeof (buf), #ifdef DEBUG /* don't print the password unless we're at the ungodly debugging level */ debuglevel < MUTT_SOCK_LOG_FULL ? "PASS *\r\n" : @@ -338,7 +338,7 @@ static pop_auth_res_t pop_auth_oauth (POP_DATA *pop_data, const char *method) snprintf (auth_cmd, auth_cmd_len, "AUTH OAUTHBEARER %s\r\n", oauthbearer); FREE (&oauthbearer); - ret = pop_query_d (pop_data, auth_cmd, strlen (auth_cmd), + ret = pop_query_d (pop_data, auth_cmd, strlen (auth_cmd), #ifdef DEBUG /* don't print the bearer token unless we're at the ungodly debugging level */ debuglevel < MUTT_SOCK_LOG_FULL ? "AUTH OAUTHBEARER *\r\n" : diff --git a/pop_lib.c b/pop_lib.c index 023745e8..afb70ef6 100644 --- a/pop_lib.c +++ b/pop_lib.c @@ -1,16 +1,16 @@ /* * Copyright (C) 2000-2003 Vsevolod Volkov - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. diff --git a/protos.h b/protos.h index b3a6e426..6b2f3a6b 100644 --- a/protos.h +++ b/protos.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2007,2010,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifdef HAVE_INTTYPES_H @@ -52,7 +52,7 @@ int _mutt_aside_thread (HEADER *, short, short); #define mutt_collapse_thread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_COLLAPSE) #define mutt_uncollapse_thread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_UNCOLLAPSE) -#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,MUTT_THREAD_GET_HIDDEN) +#define mutt_get_hidden(x,y)_mutt_traverse_thread (x,y,MUTT_THREAD_GET_HIDDEN) #define mutt_thread_contains_unread(x,y) _mutt_traverse_thread (x,y,MUTT_THREAD_UNREAD) #define mutt_thread_next_unread(x,y) _mutt_traverse_thread(x,y,MUTT_THREAD_NEXT_UNREAD) int _mutt_traverse_thread (CONTEXT *ctx, HEADER *hdr, int flag); @@ -363,7 +363,7 @@ int mutt_parse_score (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_unscore (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_parse_unhook (BUFFER *, BUFFER *, unsigned long, BUFFER *); int mutt_pattern_func (int, char *); -int mutt_pipe_attachment (FILE *, BODY *, const char *, char *); +int mutt_pipe_attachment (FILE *, BODY *, const char *, char *); int mutt_print_attachment (FILE *, BODY *); int mutt_query_complete (char *, size_t); int mutt_query_variables (LIST *queries); diff --git a/query.c b/query.c index b49bff29..457f60bd 100644 --- a/query.c +++ b/query.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2003,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -59,13 +59,13 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf); static ADDRESS *result_to_addr (QUERY *r) { static ADDRESS *tmp; - + if (!(tmp = rfc822_cpy_adr (r->addr, 0))) return NULL; - + if(!tmp->next && !tmp->personal) tmp->personal = safe_strdup (r->name); - + mutt_addrlist_to_intl (tmp, NULL); return tmp; } @@ -153,7 +153,7 @@ static QUERY *run_query (char *s, int quiet) if (!quiet) mutt_message ("%s", msg); } - + return first; } @@ -167,7 +167,7 @@ static int query_search (MUTTMENU *m, regex_t *re, int n) return 0; if (table[n].data->addr) { - if (table[n].data->addr->personal && + if (table[n].data->addr->personal && !regexec (re, table[n].data->addr->personal, 0, NULL, 0)) return 0; if (table[n].data->addr->mailbox && @@ -179,7 +179,7 @@ static int query_search (MUTTMENU *m, regex_t *re, int n) return 0; #endif } - + return REG_NOMATCH; } @@ -245,7 +245,7 @@ static int query_tag (MUTTMENU *menu, int n, int m) { ENTRY *cur = &((ENTRY *) menu->data)[n]; int ot = cur->tagged; - + cur->tagged = m >= 0 ? m : !cur->tagged; return cur->tagged - ot; } @@ -392,10 +392,10 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) if (op == OP_QUERY) { - menu->data = QueryTable = + menu->data = QueryTable = (ENTRY *) safe_calloc (menu->max, sizeof (ENTRY)); - for (i = 0, queryp = results; queryp; + for (i = 0, queryp = results; queryp; queryp = queryp->next, i++) QueryTable[i].data = queryp; } @@ -408,7 +408,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) menu->data = QueryTable; - for (i = 0, queryp = results; queryp; + for (i = 0, queryp = results; queryp; queryp = queryp->next, i++) { /* once we hit new entries, clear/init the tag */ @@ -488,7 +488,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) int tagged = 0; size_t curpos = 0; - memset (buf, 0, buflen); + memset (buf, 0, buflen); /* check for tagged entries */ for (i = 0; i < menu->max; i++) @@ -524,7 +524,7 @@ static void query_menu (char *buf, size_t buflen, QUERY *results, int retbuf) rfc822_write_address (buf, buflen, tmpa, 0); rfc822_free_address (&tmpa); } - + } free_query (&results); diff --git a/recvattach.c b/recvattach.c index 30f8664a..e37c6db3 100644 --- a/recvattach.c +++ b/recvattach.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2002,2007,2010 Michael R. Elkins * Copyright (C) 1999-2006 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -143,7 +143,7 @@ void mutt_update_tree (ATTACH_CONTEXT *actx) * %M = MIME subtype * %n = attachment number * %s = size - * %u = unlink + * %u = unlink */ const char *mutt_attach_fmt (char *dest, size_t destlen, @@ -163,7 +163,7 @@ const char *mutt_attach_fmt (char *dest, ATTACHPTR *aptr = (ATTACHPTR *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); size_t l; - + switch (op) { case 'C': @@ -216,7 +216,7 @@ const char *mutt_attach_fmt (char *dest, break; } } - else if(aptr->content->description || + else if(aptr->content->description || (mutt_is_message_type (aptr->content->type, aptr->content->subtype) && MsgFmt && aptr->content->hdr)) break; @@ -242,7 +242,7 @@ const char *mutt_attach_fmt (char *dest, if (aptr->content->filename && *aptr->content->filename == '/') { char path[_POSIX_PATH_MAX]; - + strfcpy (path, aptr->content->filename, sizeof (path)); mutt_pretty_mailbox (path, sizeof (path)); mutt_format_s (dest, destlen, prefix, path); @@ -314,7 +314,7 @@ const char *mutt_attach_fmt (char *dest, } else l = aptr->content->length; - + if(!optional) { mutt_pretty_size (tmp, sizeof(tmp), l); @@ -354,7 +354,7 @@ const char *mutt_attach_fmt (char *dest, default: *dest = 0; } - + if (optional) mutt_FormatString (dest, destlen, col, cols, ifstring, mutt_attach_fmt, data, 0); else if (flags & MUTT_FORMAT_OPTIONAL) @@ -414,8 +414,8 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * int is_message; int append = 0; int rc; - - if (body->filename) + + if (body->filename) { if (directory && *directory) mutt_concat_path (buf, *directory, mutt_basename (body->filename), sizeof (buf)); @@ -441,26 +441,26 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * mutt_clear_error (); return -1; } - + prompt = NULL; mutt_expand_path (buf, sizeof (buf)); - - is_message = (fp && - body->hdr && - body->encoding != ENCBASE64 && - body->encoding != ENCQUOTEDPRINTABLE && + + is_message = (fp && + body->hdr && + body->encoding != ENCBASE64 && + body->encoding != ENCQUOTEDPRINTABLE && mutt_is_message_type (body->type, body->subtype)); - + if (is_message) { struct stat st; - + /* check to make sure that this file is really the one the user wants */ if ((rc = mutt_save_confirm (buf, &st)) == 1) { prompt = _("Save to file: "); continue; - } + } else if (rc == -1) return -1; strfcpy(tfile, buf, sizeof(tfile)); @@ -475,7 +475,7 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * continue; } } - + mutt_message _("Saving..."); if (mutt_save_attachment (fp, body, tfile, append, (hdr || !is_message) ? hdr : body->hdr) == 0) { @@ -490,7 +490,7 @@ static int mutt_query_save_attachment (FILE *fp, BODY *body, HEADER *hdr, char * } return 0; } - + void mutt_save_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *top, HEADER *hdr, MUTTMENU *menu) { char buf[_POSIX_PATH_MAX], tfile[_POSIX_PATH_MAX]; @@ -543,7 +543,7 @@ void mutt_save_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *t } } } - else + else { if (tag && menu && top->aptr) { @@ -571,7 +571,7 @@ void mutt_save_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *t menu_check_recenter (menu); menu->redraw |= REDRAW_MOTION; } - + if (!option (OPTATTACHSPLIT) && (rc == 0)) mutt_message _("Attachment saved."); } @@ -779,7 +779,7 @@ static void print_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY void mutt_print_attachment_list (ATTACH_CONTEXT *actx, FILE *fp, int tag, BODY *top) { STATE state; - + pid_t thepid; if (query_quadoption (OPT_PRINT, tag ? _("Print tagged attachment(s)?") : _("Print attachment?")) != MUTT_YES) return; diff --git a/recvcmd.c b/recvcmd.c index 74dbf6c3..3859bfcf 100644 --- a/recvcmd.c +++ b/recvcmd.c @@ -1,22 +1,22 @@ /* * Copyright (C) 1999-2004 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Boston, MA 02110-1301, USA. */ #if HAVE_CONFIG_H @@ -88,11 +88,11 @@ static short count_tagged (ATTACH_CONTEXT *actx) { short count = 0; short i; - + for (i = 0; i < actx->idxlen; i++) if (actx->idx[i]->content->tagged) count++; - + return count; } @@ -171,7 +171,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, strfcpy (prompt, _("Bounce tagged messages to: "), sizeof (prompt)); buf[0] = '\0'; - if (mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS) + if (mutt_get_field (prompt, buf, sizeof (buf), MUTT_ALIAS) || buf[0] == '\0') return; @@ -182,7 +182,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, } adr = mutt_expand_aliases (adr); - + if (mutt_addrlist_to_intl (adr, &err) < 0) { mutt_error (_("Bad IDN: '%s'"), err); @@ -190,7 +190,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, rfc822_free_address (&adr); return; } - + buf[0] = 0; rfc822_write_address (buf, sizeof (buf), adr, 1); @@ -198,9 +198,9 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, /* * See commands.c. */ - snprintf (prompt, sizeof (prompt) - 4, + snprintf (prompt, sizeof (prompt) - 4, (p ? _("Bounce message to %s") : _("Bounce messages to %s")), buf); - + if (mutt_strwidth (prompt) > MuttMessageWindow->cols - extra_space) { mutt_format_string (prompt, sizeof (prompt) - 4, @@ -218,9 +218,9 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, mutt_message (p ? _("Message not bounced.") : _("Messages not bounced.")); return; } - + mutt_window_clearline (MuttMessageWindow, 0); - + if (cur) ret = mutt_bounce_message (fp, cur->hdr, adr); else @@ -245,7 +245,7 @@ void mutt_attach_bounce (FILE * fp, HEADER * hdr, /** ** - ** resend-message, from the attachment menu + ** resend-message, from the attachment menu ** ** **/ @@ -271,10 +271,10 @@ void mutt_attach_resend (FILE * fp, HEADER * hdr, ATTACH_CONTEXT *actx, /** ** - ** forward-message, from the attachment menu + ** forward-message, from the attachment menu ** **/ - + /* try to find a common parent message for the tagged attachments. */ static ATTACHPTR *find_common_parent (ATTACH_CONTEXT *actx, short nattach) @@ -285,7 +285,7 @@ static ATTACHPTR *find_common_parent (ATTACH_CONTEXT *actx, short nattach) for (i = 0; i < actx->idxlen; i++) if (actx->idx[i]->content->tagged) break; - + while (--i >= 0) { if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype)) @@ -299,11 +299,11 @@ static ATTACHPTR *find_common_parent (ATTACH_CONTEXT *actx, short nattach) return NULL; } -/* +/* * check whether attachment #i is a parent of the attachment * pointed to by cur - * - * Note: This and the calling procedure could be optimized quite a + * + * Note: This and the calling procedure could be optimized quite a * bit. For now, it's not worth the effort. */ @@ -324,12 +324,12 @@ static ATTACHPTR *find_parent (ATTACH_CONTEXT *actx, BODY *cur, short nattach) { short i; ATTACHPTR *parent = NULL; - + if (cur) { for (i = 0; i < actx->idxlen; i++) { - if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype) + if (mutt_is_message_type (actx->idx[i]->content->type, actx->idx[i]->content->subtype) && is_parent (i, actx, cur)) parent = actx->idx[i]; if (actx->idx[i]->content == cur) @@ -338,7 +338,7 @@ static ATTACHPTR *find_parent (ATTACH_CONTEXT *actx, BODY *cur, short nattach) } else if (nattach) parent = find_common_parent (actx, nattach); - + return parent; } @@ -348,7 +348,7 @@ static void include_header (int quote, FILE * ifp, { int chflags = CH_DECODE; char prefix[SHORT_STRING]; - + if (option (OPTWEED)) chflags |= CH_WEED | CH_REORDER; @@ -357,29 +357,29 @@ static void include_header (int quote, FILE * ifp, if (_prefix) strfcpy (prefix, _prefix, sizeof (prefix)); else if (!option (OPTTEXTFLOWED)) - _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), + _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context, hdr, 0); else strfcpy (prefix, ">", sizeof (prefix)); chflags |= CH_PREFIX; } - + mutt_copy_header (ifp, hdr, ofp, chflags, quote ? prefix : NULL); } -/* Attach all the body parts which can't be decoded. +/* Attach all the body parts which can't be decoded. * This code is shared by forwarding and replying. */ -static BODY ** copy_problematic_attachments (BODY **last, +static BODY ** copy_problematic_attachments (BODY **last, ATTACH_CONTEXT *actx, short force) { short i; - + for (i = 0; i < actx->idxlen; i++) { - if (actx->idx[i]->content->tagged && + if (actx->idx[i]->content->tagged && (force || !mutt_can_decode (actx->idx[i]->content))) { if (mutt_copy_body (actx->idx[i]->fp, last, actx->idx[i]->content) == -1) @@ -390,8 +390,8 @@ static BODY ** copy_problematic_attachments (BODY **last, return last; } -/* - * forward one or several MIME bodies +/* + * forward one or several MIME bodies * (non-message types) */ @@ -417,7 +417,7 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr, STATE st; - /* + /* * First, find the parent message. * Note: This could be made an option by just * putting the following lines into an if block. @@ -460,32 +460,32 @@ static void attach_forward_bodies (FILE * fp, HEADER * hdr, else strfcpy (prefix, ">", sizeof (prefix)); } - + include_header (option (OPTFORWQUOTE), parent_fp, parent_hdr, tmpfp, prefix); - /* + /* * Now, we have prepared the first part of the message body: The - * original message's header. + * original message's header. * * The next part is more interesting: either include the message bodies, * or attach them. */ if ((!cur || mutt_can_decode (cur)) && - (rc = query_quadoption (OPT_MIMEFWD, + (rc = query_quadoption (OPT_MIMEFWD, _("Forward as attachments?"))) == MUTT_YES) mime_fwd_all = 1; else if (rc == -1) goto bail; - /* - * shortcut MIMEFWDREST when there is only one attachment. Is + /* + * shortcut MIMEFWDREST when there is only one attachment. Is * this intuitive? */ - if (!mime_fwd_all && !cur && (nattach > 1) + if (!mime_fwd_all && !cur && (nattach > 1) && !check_can_decode (actx, cur)) { if ((rc = query_quadoption (OPT_MIMEFWDREST, @@ -496,9 +496,9 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) } /* initialize a state structure */ - + memset (&st, 0, sizeof (st)); - + if (option (OPTFORWQUOTE)) st.prefix = prefix; st.flags = MUTT_CHARCONV; @@ -543,22 +543,22 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) } } - if (mime_fwd_any && + if (mime_fwd_any && copy_problematic_attachments (last, actx, mime_fwd_all) == NULL) goto bail; } - + mutt_forward_trailer (Context, parent_hdr, tmpfp); - + safe_fclose (&tmpfp); tmpfp = NULL; /* now that we have the template, send it. */ ci_send_message (0, tmphdr, tmpbody, NULL, parent_hdr); return; - + bail: - + if (tmpfp) { safe_fclose (&tmpfp); @@ -569,18 +569,18 @@ _("Can't decode all tagged attachments. MIME-forward the others?"))) == -1) } -/* - * Forward one or several message-type attachments. This +/* + * Forward one or several message-type attachments. This * is different from the previous function * since we want to mimic the index menu's behavior. * * Code reuse from ci_send_message is not possible here - * ci_send_message relies on a context structure to find messages, * while, on the attachment menu, messages are referenced through - * the attachment index. + * the attachment index. */ -static void attach_forward_msgs (FILE * fp, HEADER * hdr, +static void attach_forward_msgs (FILE * fp, HEADER * hdr, ATTACH_CONTEXT *actx, BODY * cur) { HEADER *curhdr = NULL; @@ -594,7 +594,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, int cmflags = 0; int chflags = CH_XMIT; - + if (cur) curhdr = cur->hdr; else @@ -614,12 +614,12 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, tmpbody[0] = '\0'; - if ((rc = query_quadoption (OPT_MIMEFWD, + if ((rc = query_quadoption (OPT_MIMEFWD, _("Forward MIME encapsulated?"))) == MUTT_NO) { - + /* no MIME encapsulation */ - + mutt_mktemp (tmpbody, sizeof (tmpbody)); if (!(tmpfp = safe_fopen (tmpbody, "w"))) { @@ -643,11 +643,11 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, cmflags |= MUTT_CM_WEED; } } - - + + if (cur) { - /* mutt_message_hook (cur->hdr, MUTT_MESSAGEHOOK); */ + /* mutt_message_hook (cur->hdr, MUTT_MESSAGEHOOK); */ mutt_forward_intro (Context, cur->hdr, tmpfp); _mutt_copy_message (tmpfp, fp, cur->hdr, cur->hdr->content, cmflags, chflags); mutt_forward_trailer (Context, cur->hdr, tmpfp); @@ -658,7 +658,7 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, { if (actx->idx[i]->content->tagged) { - /* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */ + /* mutt_message_hook (idx[i]->content->hdr, MUTT_MESSAGEHOOK); */ mutt_forward_intro (Context, actx->idx[i]->content->hdr, tmpfp); _mutt_copy_message (tmpfp, actx->idx[i]->fp, actx->idx[i]->content->hdr, actx->idx[i]->content->hdr->content, cmflags, chflags); @@ -686,16 +686,16 @@ static void attach_forward_msgs (FILE * fp, HEADER * hdr, else mutt_free_header (&tmphdr); - ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL, + ci_send_message (0, tmphdr, *tmpbody ? tmpbody : NULL, NULL, curhdr); } -void mutt_attach_forward (FILE * fp, HEADER * hdr, +void mutt_attach_forward (FILE * fp, HEADER * hdr, ATTACH_CONTEXT *actx, BODY * cur) { short nattach; - + if (check_all_msg (actx, cur, 0) == 0) attach_forward_msgs (fp, hdr, actx, cur); @@ -744,7 +744,7 @@ void mutt_attach_mail_sender (FILE *fp, HEADER *hdr, ATTACH_CONTEXT *actx, /** - ** + ** ** the various reply functions, from the attachment menu ** ** @@ -753,16 +753,16 @@ void mutt_attach_mail_sender (FILE *fp, HEADER *hdr, ATTACH_CONTEXT *actx, /* Create the envelope defaults for a reply. * * This function can be invoked in two ways. - * + * * Either, parent is NULL. In this case, all tagged bodies are of a message type, * and the header information is fetched from them. - * + * * Or, parent is non-NULL. In this case, cur is the common parent of all the * tagged attachments. - * + * * Note that this code is horribly similar to envelope_defaults () from send.c. */ - + static int attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx, HEADER *parent, int flags) @@ -770,7 +770,7 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx, ENVELOPE *curenv = NULL; HEADER *curhdr = NULL; short i; - + if (!parent) { for (i = 0; i < actx->idxlen; i++) @@ -809,13 +809,13 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx, return -1; } } - + if ((flags & SENDLISTREPLY) && !env->to) { mutt_error _("No mailing lists found!"); return (-1); } - + mutt_fix_reply_recipients (env); mutt_make_misc_reply_headers (env, Context, curhdr, curenv); @@ -824,14 +824,14 @@ attach_reply_envelope_defaults (ENVELOPE *env, ATTACH_CONTEXT *actx, else { LIST **p = NULL, **q = NULL; - + for (i = 0; i < actx->idxlen; i++) { if (actx->idx[i]->content->tagged) mutt_add_to_reference_headers (env, actx->idx[i]->content->hdr->env, &p, &q); } } - + return 0; } @@ -843,10 +843,10 @@ static void attach_include_reply (FILE *fp, FILE *tmpfp, HEADER *cur, int flags) int cmflags = MUTT_CM_PREFIX | MUTT_CM_DECODE | MUTT_CM_CHARCONV; int chflags = CH_DECODE; - /* mutt_message_hook (cur, MUTT_MESSAGEHOOK); */ - + /* mutt_message_hook (cur, MUTT_MESSAGEHOOK); */ + mutt_make_attribution (Context, cur, tmpfp); - + if (!option (OPTHEADER)) cmflags |= MUTT_CM_NOHEADER; if (option (OPTWEED)) @@ -858,13 +858,13 @@ static void attach_include_reply (FILE *fp, FILE *tmpfp, HEADER *cur, int flags) _mutt_copy_message (tmpfp, fp, cur, cur->content, cmflags, chflags); mutt_make_post_indent (Context, cur, tmpfp); } - + void mutt_attach_reply (FILE * fp, HEADER * hdr, ATTACH_CONTEXT *actx, BODY * cur, int flags) { short mime_reply_any = 0; - + short nattach = 0; ATTACHPTR *parent = NULL; HEADER *parent_hdr = NULL; @@ -875,10 +875,10 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, STATE st; char tmpbody[_POSIX_PATH_MAX]; FILE *tmpfp; - + char prefix[SHORT_STRING]; int rc; - + if (check_all_msg (actx, cur, 0) == -1) { nattach = count_tagged (actx); @@ -914,7 +914,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, mutt_free_header (&tmphdr); return; } - + mutt_mktemp (tmpbody, sizeof (tmpbody)); if ((tmpfp = safe_fopen (tmpbody, "w")) == NULL) { @@ -939,20 +939,20 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, else { mutt_make_attribution (Context, parent_hdr, tmpfp); - + memset (&st, 0, sizeof (STATE)); st.fpout = tmpfp; if (!option (OPTTEXTFLOWED)) - _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), + _mutt_make_string (prefix, sizeof (prefix), NONULL (Prefix), Context, parent_hdr, 0); else strfcpy (prefix, ">", sizeof (prefix)); st.prefix = prefix; st.flags = MUTT_CHARCONV; - - if (option (OPTWEED)) + + if (option (OPTWEED)) st.flags |= MUTT_WEED; if (option (OPTHEADER)) @@ -984,7 +984,7 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, mutt_make_post_indent (Context, parent_hdr, tmpfp); - if (mime_reply_any && !cur && + if (mime_reply_any && !cur && copy_problematic_attachments (&tmphdr->content, actx, 0) == NULL) { mutt_free_header (&tmphdr); @@ -994,9 +994,8 @@ void mutt_attach_reply (FILE * fp, HEADER * hdr, } safe_fclose (&tmpfp); - + if (ci_send_message (flags, tmphdr, tmpbody, NULL, parent_hdr ? parent_hdr : (cur ? cur->hdr : NULL)) == 0) mutt_set_flag (Context, hdr, MUTT_REPLIED, 1); } - diff --git a/regex.c b/regex.c index cfbfb58f..762d3ff7 100644 --- a/regex.c +++ b/regex.c @@ -2,31 +2,31 @@ * version 0.12. * (Implements POSIX draft P1003.2/D11.2, except for some of the * internationalization features.) - * + * * Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. - * + * * This file is part of the GNU C Library. Its master source is NOT part of * the C library, however. The master source lives in /gd/gnu/lib. - * + * * The GNU C Library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public License as * published by the Free Software Foundation; either version 2 of the * License, or (at your option) any later version. - * + * * The GNU C Library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Library General Public License for more details. - * + * * You should have received a copy of the GNU Library General Public * License along with the GNU C Library; see the file COPYING.LIB. If not, * write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. + * Boston, MA 02110-1301, USA. */ /* * Modifications: - * + * * Use _regex.h instead of regex.h. tlr, 1999-01-06 * Make REGEX_MALLOC depend on HAVE_ALLOCA &c. * tlr, 1999-02-14 diff --git a/remailer.c b/remailer.c index ca2f3359..02a926a2 100644 --- a/remailer.c +++ b/remailer.c @@ -1,23 +1,23 @@ /* * Copyright (C) 1999-2001 Thomas Roessler - * + * * This program is free software; you can redistribute it * and/or modify it under the terms of the GNU General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, * Boston, MA 02110-1301, USA. - */ + */ /* * Mixmaster support for Mutt @@ -75,11 +75,11 @@ static int mix_get_caps (const char *capstr) case 'C': caps |= MIX_CAP_COMPRESS; break; - + case 'M': caps |= MIX_CAP_MIDDLEMAN; break; - + case 'N': { switch (*++capstr) @@ -87,18 +87,18 @@ static int mix_get_caps (const char *capstr) case 'm': caps |= MIX_CAP_NEWSMAIL; break; - + case 'p': caps |= MIX_CAP_NEWSPOST; break; - + } } } - + if (*capstr) capstr++; } - + return caps; } @@ -110,7 +110,7 @@ static void mix_add_entry (REMAILER ***type2_list, REMAILER *entry, *slots += 5; safe_realloc (type2_list, sizeof (REMAILER *) * (*slots)); } - + (*type2_list)[(*used)++] = entry; if (entry) entry->num = *used; } @@ -125,7 +125,7 @@ static void mix_free_remailer (REMAILER **r) FREE (&(*r)->shortname); FREE (&(*r)->addr); FREE (&(*r)->ver); - + FREE (r); /* __FREE_CHECKED__ */ } @@ -140,18 +140,18 @@ static REMAILER **mix_type2_list (size_t *l) char cmd[HUGE_STRING + _POSIX_PATH_MAX]; char line[HUGE_STRING]; char *t; - + REMAILER **type2_list = NULL, *p; size_t slots = 0, used = 0; if (!l) return NULL; - + if ((devnull = open ("/dev/null", O_RDWR)) == -1) return NULL; - + snprintf (cmd, sizeof (cmd), "%s -T", Mixmaster); - + if ((mm_pid = mutt_create_filter_fd (cmd, NULL, &fp, NULL, devnull, -1, devnull)) == -1) { close (devnull); @@ -159,25 +159,25 @@ static REMAILER **mix_type2_list (size_t *l) } /* first, generate the "random" remailer */ - + p = mix_new_remailer (); p->shortname = safe_strdup (""); mix_add_entry (&type2_list, p, &slots, &used); - + while (fgets (line, sizeof (line), fp)) { p = mix_new_remailer (); - + if (!(t = strtok (line, " \t\n"))) goto problem; - + p->shortname = safe_strdup (t); - + if (!(t = strtok (NULL, " \t\n"))) goto problem; p->addr = safe_strdup (t); - + if (!(t = strtok (NULL, " \t\n"))) goto problem; @@ -185,26 +185,26 @@ static REMAILER **mix_type2_list (size_t *l) goto problem; p->ver = safe_strdup (t); - + if (!(t = strtok (NULL, " \t\n"))) goto problem; p->caps = mix_get_caps (t); - + mix_add_entry (&type2_list, p, &slots, &used); continue; - + problem: mix_free_remailer (&p); } - + *l = used; mix_add_entry (&type2_list, NULL, &slots, &used); mutt_wait_filter (mm_pid); close (devnull); - + return type2_list; } @@ -212,10 +212,10 @@ static void mix_free_type2_list (REMAILER ***ttlp) { int i; REMAILER **type2_list = *ttlp; - + for (i = 0; type2_list[i]; i++) mix_free_remailer (&type2_list[i]); - + FREE (type2_list); /* __FREE_CHECKED__ */ } @@ -235,11 +235,11 @@ static void mix_screen_coordinates (REMAILER **type2_list, if (!chain->cl) return; - + safe_realloc (coordsp, sizeof (struct coord) * chain->cl); - + coords = *coordsp; - + if (i) { c = coords[i-1].c + strlen (type2_list[chain->ch[i-1]]->shortname) + 2; @@ -250,8 +250,8 @@ static void mix_screen_coordinates (REMAILER **type2_list, r = MIX_VOFFSET; c = MIX_HOFFSET; } - - + + for (; i < chain->cl; i++) { oc = c; @@ -262,12 +262,12 @@ static void mix_screen_coordinates (REMAILER **type2_list, oc = c = MIX_HOFFSET; r++; } - + coords[i].c = oc; coords[i].r = r; - + } - + } static void mix_redraw_ce (REMAILER **type2_list, @@ -278,15 +278,15 @@ static void mix_redraw_ce (REMAILER **type2_list, { if (!coords || !chain) return; - + if (coords[i].r < MIX_MAXROW) { - + if (selected) SETCOLOR (MT_COLOR_INDICATOR); else NORMAL_COLOR; - + mutt_window_mvaddstr (MuttIndexWindow, coords[i].r, coords[i].c, type2_list[chain->ch[i]]->shortname); NORMAL_COLOR; @@ -302,7 +302,7 @@ static void mix_redraw_chain (REMAILER **type2_list, int cur) { int i; - + for (i = MIX_VOFFSET; i < MIX_MAXROW; i++) { mutt_window_move (MuttIndexWindow, i, 0); @@ -326,17 +326,17 @@ static const char *mix_format_caps (REMAILER *r) { static char capbuff[10]; char *t = capbuff; - + if (r->caps & MIX_CAP_COMPRESS) *t++ = 'C'; else *t++ = ' '; - + if (r->caps & MIX_CAP_MIDDLEMAN) *t++ = 'M'; else *t++ = ' '; - + if (r->caps & MIX_CAP_NEWSPOST) { *t++ = 'N'; @@ -347,7 +347,7 @@ static const char *mix_format_caps (REMAILER *r) *t++ = ' '; *t++ = ' '; } - + if (r->caps & MIX_CAP_NEWSMAIL) { *t++ = 'N'; @@ -358,15 +358,15 @@ static const char *mix_format_caps (REMAILER *r) *t++ = ' '; *t++ = ' '; } - + *t = '\0'; - + return capbuff; } /* * Format an entry for the remailer menu. - * + * * %n number * %c capabilities * %s short name @@ -424,7 +424,7 @@ static const char *mix_entry_fmt (char *dest, else if (!remailer->addr) optional = 0; break; - + default: *dest = '\0'; } @@ -437,7 +437,7 @@ static const char *mix_entry_fmt (char *dest, } - + static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num) { REMAILER **type2_list = (REMAILER **) menu->data; @@ -445,14 +445,14 @@ static void mix_entry (char *b, size_t blen, MUTTMENU *menu, int num) (unsigned long) type2_list[num], MUTT_FORMAT_ARROWCURSOR); } -static int mix_chain_add (MIXCHAIN *chain, const char *s, +static int mix_chain_add (MIXCHAIN *chain, const char *s, REMAILER **type2_list) { int i; - + if (chain->cl >= MAXMIXES) return -1; - + if (!mutt_strcmp (s, "0") || !ascii_strcasecmp (s, "")) { chain->ch[chain->cl++] = 0; @@ -467,16 +467,16 @@ static int mix_chain_add (MIXCHAIN *chain, const char *s, return 0; } } - + /* replace unknown remailers by */ - + if (!type2_list[i]) chain->ch[chain->cl++] = 0; return 0; } -static const struct mapping_t RemailerHelp[] = +static const struct mapping_t RemailerHelp[] = { { N_("Append"), OP_MIX_APPEND }, { N_("Insert"), OP_MIX_INSERT }, @@ -485,7 +485,7 @@ static const struct mapping_t RemailerHelp[] = { N_("OK"), OP_MIX_USE }, { NULL, 0 } }; - + void mix_make_chain (LIST **chainp) { @@ -493,17 +493,17 @@ void mix_make_chain (LIST **chainp) MIXCHAIN *chain; int c_cur = 0, c_old = 0; short c_redraw = 1; - + REMAILER **type2_list = NULL; size_t ttll = 0; - + struct coord *coords = NULL; - + MUTTMENU *menu; char helpstr[LONG_STRING]; short loop = 1; int op; - + int i, j; char *t; @@ -518,16 +518,16 @@ void mix_make_chain (LIST **chainp) mix_chain_add (chain, (char *) p->data, type2_list); mutt_free_list (chainp); - + /* safety check */ for (i = 0; i < chain->cl; i++) { if (chain->ch[i] >= ttll) chain->ch[i] = 0; } - + mix_screen_coordinates (type2_list, &coords, chain, 0); - + menu = mutt_new_menu (MENU_MIX); menu->max = ttll; menu->make_entry = mix_entry; @@ -537,15 +537,15 @@ void mix_make_chain (LIST **chainp) menu->help = mutt_compile_help (helpstr, sizeof (helpstr), MENU_MIX, RemailerHelp); menu->pagelen = MIX_VOFFSET - 1; mutt_push_current_menu (menu); - - while (loop) + + while (loop) { if (menu->pagelen != MIX_VOFFSET - 1) { menu->pagelen = MIX_VOFFSET - 1; menu->redraw = REDRAW_FULL; } - + if (c_redraw) { mix_redraw_head (chain); @@ -557,9 +557,9 @@ void mix_make_chain (LIST **chainp) mix_redraw_ce (type2_list, coords, chain, c_old, 0); mix_redraw_ce (type2_list, coords, chain, c_cur, 1); } - + c_old = c_cur; - + switch ((op = mutt_menuLoop (menu))) { case OP_REDRAW: @@ -571,7 +571,7 @@ void mix_make_chain (LIST **chainp) menu->pagelen = MIX_VOFFSET - 1; break; } - + case OP_EXIT: { chain->cl = 0; @@ -588,8 +588,8 @@ void mix_make_chain (LIST **chainp) mix_screen_coordinates (type2_list, &coords, chain, c_cur); c_redraw = 1; } - - if (chain->cl && chain->ch[chain->cl - 1] && + + if (chain->cl && chain->ch[chain->cl - 1] && (type2_list[chain->ch[chain->cl-1]]->caps & MIX_CAP_MIDDLEMAN)) { mutt_error ( _("Error: %s can't be used as the final remailer of a chain."), @@ -616,7 +616,7 @@ void mix_make_chain (LIST **chainp) chain->cl++; for (i = chain->cl - 1; i > c_cur; i--) chain->ch[i] = chain->ch[i-1]; - + chain->ch[c_cur] = menu->current; mix_screen_coordinates (type2_list, &coords, chain, c_cur); c_redraw = 1; @@ -624,22 +624,22 @@ void mix_make_chain (LIST **chainp) else mutt_error ( _("Mixmaster chains are limited to %d elements."), MAXMIXES); - + break; } - + case OP_MIX_DELETE: { if (chain->cl) { chain->cl--; - + for (i = c_cur; i < chain->cl; i++) chain->ch[i] = chain->ch[i+1]; if (c_cur == chain->cl && c_cur) c_cur--; - + mix_screen_coordinates (type2_list, &coords, chain, c_cur); c_redraw = 1; } @@ -649,34 +649,34 @@ void mix_make_chain (LIST **chainp) } break; } - + case OP_MIX_CHAIN_PREV: { - if (c_cur) + if (c_cur) c_cur--; else mutt_error _("You already have the first chain element selected."); - + break; } - + case OP_MIX_CHAIN_NEXT: { if (chain->cl && c_cur < chain->cl - 1) c_cur++; else mutt_error _("You already have the last chain element selected."); - + break; } } } - + mutt_pop_current_menu (menu); mutt_menuDestroy (&menu); /* construct the remailer list */ - + if (chain->cl) { for (i = 0; i < chain->cl; i++) @@ -685,11 +685,11 @@ void mix_make_chain (LIST **chainp) t = type2_list[j]->shortname; else t = "*"; - + *chainp = mutt_add_list (*chainp, t); } } - + mix_free_type2_list (&type2_list); FREE (&coords); FREE (&chain); @@ -702,7 +702,7 @@ int mix_check_message (HEADER *msg) const char *fqdn; short need_hostname = 0; ADDRESS *p; - + if (msg->env->cc || msg->env->bcc) { mutt_error _("Mixmaster doesn't accept Cc or Bcc headers."); @@ -711,7 +711,7 @@ int mix_check_message (HEADER *msg) /* When using mixmaster, we MUST qualify any addresses since * the message will be delivered through remote systems. - * + * * use_domain won't be respected at this point, hidden_host will. */ @@ -723,16 +723,16 @@ int mix_check_message (HEADER *msg) break; } } - + if (need_hostname) { - + if (!(fqdn = mutt_fqdn (1))) { mutt_error _("Please set the hostname variable to a proper value when using mixmaster!"); return (-1); } - + /* Cc and Bcc are empty at this point. */ rfc822_qualify (msg->env->to, fqdn); rfc822_qualify (msg->env->reply_to, fqdn); diff --git a/remailer.h b/remailer.h index c76593f0..db3c4d43 100644 --- a/remailer.h +++ b/remailer.h @@ -3,21 +3,21 @@ /* * Copyright (C) 1999-2000 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * Mixmaster support for Mutt diff --git a/resize.c b/resize.c index 2e77d218..01d84e46 100644 --- a/resize.c +++ b/resize.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" diff --git a/rfc1524.c b/rfc1524.c index 311d5e05..06feb7e2 100644 --- a/rfc1524.c +++ b/rfc1524.c @@ -1,28 +1,28 @@ /* * Copyright (C) 1996-2000,2003,2012 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ -/* +/* * rfc1524 defines a format for the Multimedia Mail Configuration, which - * is the standard mailcap file format under Unix which specifies what + * is the standard mailcap file format under Unix which specifies what * external programs should be used to view/compose/edit multimedia files * based on content type. * - * This file contains various functions for implementing a fair subset of + * This file contains various functions for implementing a fair subset of * rfc1524. */ @@ -74,9 +74,9 @@ int rfc1524_expand_command (BODY *a, const char *filename, const char *_type, int needspipe = TRUE; char buf[LONG_STRING]; char type[LONG_STRING]; - + strfcpy (type, _type, sizeof (type)); - + if (option (OPTMAILCAPSANITIZE)) mutt_sanitize_filename (type, 0); @@ -87,10 +87,10 @@ int rfc1524_expand_command (BODY *a, const char *filename, const char *_type, x++; buf[y++] = command[x++]; } - else if (command[x] == '%') + else if (command[x] == '%') { x++; - if (command[x] == '{') + if (command[x] == '{') { char param[STRING]; char pvalue[STRING]; @@ -101,12 +101,12 @@ int rfc1524_expand_command (BODY *a, const char *filename, const char *_type, while (command[x] && command[x] != '}' && z < sizeof (param) - 1) param[z++] = command[x++]; param[z] = '\0'; - + _pvalue = mutt_get_parameter (param, a->parameter); strfcpy (pvalue, NONULL(_pvalue), sizeof (pvalue)); if (option (OPTMAILCAPSANITIZE)) mutt_sanitize_filename (pvalue, 0); - + y += mutt_quote_filename (buf + y, sizeof (buf) - y, pvalue); } else if (command[x] == 's' && filename != NULL) @@ -171,7 +171,7 @@ static int get_field_text (char *field, char **entry, } return 1; } - else + else { mutt_error (_("Improperly formatted entry for type %s in \"%s\" line %d"), type, filename, line); @@ -181,7 +181,7 @@ static int get_field_text (char *field, char **entry, static int rfc1524_mailcap_parse (BODY *a, char *filename, - char *type, + char *type, rfc1524_entry *entry, int opt) { @@ -298,7 +298,7 @@ static int rfc1524_mailcap_parse (BODY *a, } else if (!ascii_strncasecmp (field, "test", 4)) { - /* + /* * This routine executes the given test command to determine * if this is the right entry. */ @@ -341,7 +341,7 @@ static int rfc1524_mailcap_parse (BODY *a, if (!printcommand) found = FALSE; } - + if (!found) { /* reset */ @@ -398,7 +398,7 @@ int rfc1524_mailcap_lookup (BODY *a, char *type, rfc1524_entry *entry, int opt) char *curr = MailcapPath; /* rfc1524 specifies that a path of mailcap files should be searched. - * joy. They say + * joy. They say * $HOME/.mailcap:/etc/mailcap:/usr/etc/mailcap:/usr/local/etc/mailcap, etc * and overridden by the MAILCAPS environment variable, and, just to be nice, * we'll make it specifiable in .muttrc @@ -424,7 +424,7 @@ int rfc1524_mailcap_lookup (BODY *a, char *type, rfc1524_entry *entry, int opt) if (!x) continue; - + path[x] = '\0'; mutt_expand_path (path, sizeof (path)); @@ -441,11 +441,11 @@ int rfc1524_mailcap_lookup (BODY *a, char *type, rfc1524_entry *entry, int opt) /* This routine will create a _temporary_ filename matching the * name template given if this needs to be done. - * + * * Please note that only the last path element of the * template and/or the old file name will be used for the * comparison and the temporary file name. - * + * * Returns 0 if oldfile is fine as is. * Returns 1 if newfile specified */ @@ -477,21 +477,21 @@ int rfc1524_expand_filename (const char *nametemplate, { int i, j, k, ps; char *s; - short lmatch = 0, rmatch = 0; + short lmatch = 0, rmatch = 0; char left[_POSIX_PATH_MAX]; char right[_POSIX_PATH_MAX]; - + newfile[0] = 0; /* first, ignore leading path components. */ - + if (nametemplate && (s = strrchr (nametemplate, '/'))) nametemplate = s + 1; if (oldfile && (s = strrchr (oldfile, '/'))) oldfile = s + 1; - + if (!nametemplate) { if (oldfile) @@ -504,15 +504,15 @@ int rfc1524_expand_filename (const char *nametemplate, else /* oldfile && nametemplate */ { - /* first, compare everything left from the "%s" + /* first, compare everything left from the "%s" * (if there is one). */ - + lmatch = 1; ps = 0; for(i = 0; nametemplate[i]; i++) { if(nametemplate[i] == '%' && nametemplate[i+1] == 's') - { + { ps = 1; break; } @@ -525,22 +525,22 @@ int rfc1524_expand_filename (const char *nametemplate, if(ps) { - + /* If we had a "%s", check the rest. */ - - /* now, for the right part: compare everything right from + + /* now, for the right part: compare everything right from * the "%s" to the final part of oldfile. - * + * * The logic here is as follows: - * + * * - We start reading from the end. * - There must be a match _right_ from the "%s", - * thus the i + 2. + * thus the i + 2. * - If there was a left hand match, this stuff * must not be counted again. That's done by the * condition (j >= (lmatch ? i : 0)). */ - + rmatch = 1; for(j = mutt_strlen(oldfile) - 1, k = mutt_strlen(nametemplate) - 1 ; @@ -553,18 +553,18 @@ int rfc1524_expand_filename (const char *nametemplate, break; } } - + /* Now, check if we had a full match. */ - + if(k >= i + 2) rmatch = 0; - + if(lmatch) *left = 0; else strnfcpy(left, nametemplate, sizeof(left), i); - + if(rmatch) *right = 0; else strfcpy(right, nametemplate + i + 2, sizeof(right)); - + snprintf(newfile, nflen, "%s%s%s", left, oldfile, right); } else @@ -573,14 +573,14 @@ int rfc1524_expand_filename (const char *nametemplate, strfcpy(newfile, nametemplate, nflen); } } - + mutt_adv_mktemp(newfile, nflen); if(rmatch && lmatch) return 0; - else + else return 1; - + } /* If rfc1524_expand_command() is used on a recv'd message, then diff --git a/rfc1524.h b/rfc1524.h index 5c1bd6ed..b63a59ac 100644 --- a/rfc1524.h +++ b/rfc1524.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef _RFC1524_H #define _RFC1524_H diff --git a/rfc2047.c b/rfc2047.c index 930e7c77..f67fe652 100644 --- a/rfc2047.c +++ b/rfc2047.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000,2010 Michael R. Elkins * Copyright (C) 2000-2002 Edmund Grimley Evans - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -77,7 +77,7 @@ static size_t convert_string (ICONV_CONST char *f, size_t flen, return (size_t)(-1); } *ob = '\0'; - + *tlen = ob - buf; safe_realloc (&buf, ob - buf + 1); @@ -182,7 +182,7 @@ char *mutt_choose_charset (const char *fromcode, const char *charsets, *d = e; if (dlen) *dlen = elen; - + mutt_canonical_charset (canonical_buff, sizeof (canonical_buff), tocode); mutt_str_replace (&tocode, canonical_buff); } @@ -420,7 +420,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, /* Try to convert to UTF-8. */ if (convert_string (d, dlen, fromcode, icode, &u, &ulen)) { - ret = 1; + ret = 1; icode = 0; safe_realloc (&u, (ulen = dlen) + 1); memcpy (u, d, dlen); @@ -431,7 +431,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, s0 = s1 = t0 = t1 = 0; for (t = u; t < u + ulen; t++) { - if ((*t & 0x80) || + if ((*t & 0x80) || (*t == '=' && t[1] == '?' && (t == u || HSPACE(*(t-1))))) { if (!t0) t0 = t; @@ -471,12 +471,12 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, /* Hack to avoid labelling 8-bit data as us-ascii. */ if (!icode && mutt_is_us_ascii (tocode)) tocode = "unknown-8bit"; - + /* Adjust t0 for maximum length of line. */ t = u + (ENCWORD_LEN_MAX + 1) - col - ENCWORD_LEN_MIN; if (t < u) t = u; if (t < t0) t0 = t; - + /* Adjust t0 until we can encode a character after a space. */ for (; t0 > u; t0--) @@ -577,7 +577,7 @@ static int rfc2047_encode (ICONV_CONST char *d, size_t dlen, int col, FREE (&u); buf[buflen] = '\0'; - + *e = buf; *elen = buflen + 1; return ret; @@ -608,7 +608,7 @@ void rfc2047_encode_adrlist (ADDRESS *addr, const char *tag) { ADDRESS *ptr = addr; int col = tag ? strlen (tag) + 2 : 32; - + while (ptr) { if (ptr->personal) @@ -662,7 +662,7 @@ static int rfc2047_decode_word (BUFFER *d, const char *s, char **charset) switch (count) { case 2: - /* ignore language specification a la RFC 2231 */ + /* ignore language specification a la RFC 2231 */ t = pp1; if ((t1 = memchr (pp, '*', t - pp))) t = t1; @@ -722,7 +722,7 @@ static int rfc2047_decode_word (BUFFER *d, const char *s, char **charset) break; } } - + mutt_buffer_addstr (d, d0); rv = 0; error_out_0: @@ -949,7 +949,7 @@ void rfc2047_decode_adrlist (ADDRESS *a) { while (a) { - if (a->personal && ((strstr (a->personal, "=?") != NULL) || + if (a->personal && ((strstr (a->personal, "=?") != NULL) || (AssumedCharset && *AssumedCharset))) rfc2047_decode (&a->personal); else if (a->group && a->mailbox && (strstr (a->mailbox, "=?") != NULL)) diff --git a/rfc2047.h b/rfc2047.h index 6565af62..0194bf98 100644 --- a/rfc2047.h +++ b/rfc2047.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ char *mutt_choose_charset (const char *fromcode, const char *charsets, char *u, size_t ulen, char **d, size_t *dlen); diff --git a/rfc2231.c b/rfc2231.c index 05e81c3d..48919391 100644 --- a/rfc2231.c +++ b/rfc2231.c @@ -6,13 +6,13 @@ * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later * version. - * + * * This program is distributed in the hope that it will be * useful, but WITHOUT ANY WARRANTY; without even the implied * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR * PURPOSE. See the GNU General Public License for more * details. - * + * * You should have received a copy of the GNU General Public * License along with this program; if not, write to the Free * Software Foundation, Inc., 51 Franklin Street, Fifth Floor, @@ -23,7 +23,7 @@ * Yet another MIME encoding for header data. This time, it's * parameters, specified in RFC 2231, and modeled after the * encoding used in URLs. - * + * * Additionally, continuations and encoding are mixed in an, errrm, * interesting manner. * @@ -49,7 +49,7 @@ struct rfc2231_parameter char *value; int index; int encoded; - struct rfc2231_parameter + struct rfc2231_parameter *next; }; @@ -63,7 +63,7 @@ static void rfc2231_list_insert (struct rfc2231_parameter **, struct rfc2231_par static void purge_empty_parameters (PARAMETER **headp) { PARAMETER *p, *q, **last; - + for (last = headp, p = *headp; p; p = q) { q = p->next; @@ -96,11 +96,11 @@ void rfc2231_decode_parameters (PARAMETER **headp) short dirty = 0; /* set to 1 when we may have created * empty parameters. */ - + if (!headp) return; purge_empty_parameters (headp); - + for (last = &head, p = *headp; p; p = q) { q = p->next; @@ -108,10 +108,10 @@ void rfc2231_decode_parameters (PARAMETER **headp) if (!(s = strchr (p->attribute, '*'))) { - /* + /* * Using RFC 2047 encoding in MIME parameters is explicitly * forbidden by that document. Nevertheless, it's being - * generated by some software, including certain Lotus Notes to + * generated by some software, including certain Lotus Notes to * Internet Gateways. So we actually decode it. */ @@ -127,7 +127,7 @@ void rfc2231_decode_parameters (PARAMETER **headp) else if (*(s + 1) == '\0') { *s = '\0'; - + s = rfc2231_get_charset (p->value, charset, sizeof (charset)); rfc2231_decode_one (p->value, s); mutt_convert_string (&p->value, charset, Charset, MUTT_ICONV_HOOK_FROM); @@ -136,7 +136,7 @@ void rfc2231_decode_parameters (PARAMETER **headp) *last = p; last = &p->next; p->next = NULL; - + dirty = 1; } else @@ -154,7 +154,7 @@ void rfc2231_decode_parameters (PARAMETER **headp) conttmp->value = p->value; conttmp->encoded = encoded; conttmp->index = index; - + p->attribute = NULL; p->value = NULL; FREE (&p); @@ -168,13 +168,13 @@ void rfc2231_decode_parameters (PARAMETER **headp) rfc2231_join_continuations (last, conthead); dirty = 1; } - + *headp = head; - + if (dirty) purge_empty_parameters (headp); } - + static struct rfc2231_parameter *rfc2231_new_parameter (void) { return safe_calloc (sizeof (struct rfc2231_parameter), 1); @@ -193,16 +193,16 @@ static void rfc2231_free_parameter (struct rfc2231_parameter **p) static char *rfc2231_get_charset (char *value, char *charset, size_t chslen) { char *t, *u; - + if (!(t = strchr (value, '\''))) { charset[0] = '\0'; return value; } - + *t = '\0'; strfcpy (charset, value, chslen); - + if ((u = strchr (t + 1, '\''))) return u + 1; else @@ -225,12 +225,12 @@ static void rfc2231_decode_one (char *dest, char *src) else *d++ = *src; } - + *d = '\0'; } /* insert parameter into an ordered list. - * + * * Primary sorting key: attribute * Secondary sorting key: index */ @@ -270,11 +270,11 @@ static void rfc2231_join_continuations (PARAMETER **head, int encoded; size_t l, vl; - + while (par) { value = NULL; l = 0; - + strfcpy (attribute, par->attribute, sizeof (attribute)); if ((encoded = par->encoded)) @@ -282,13 +282,13 @@ static void rfc2231_join_continuations (PARAMETER **head, else valp = par->value; - do + do { if (encoded && par->encoded) rfc2231_decode_one (par->value, valp); - + vl = strlen (par->value); - + safe_realloc (&value, l + vl + 1); strcpy (value + l, par->value); /* __STRCPY_CHECKED__ */ l += vl; @@ -298,7 +298,7 @@ static void rfc2231_join_continuations (PARAMETER **head, if ((par = q)) valp = par->value; } while (par && !strcmp (par->attribute, attribute)); - + if (value) { if (encoded) @@ -317,9 +317,9 @@ int rfc2231_encode_string (char **pd) char *charset, *s, *t, *e, *d = 0; size_t slen, dlen = 0; - /* + /* * A shortcut to detect pure 7bit data. - * + * * This should prevent the worst when character set handling * is flawed. */ @@ -327,10 +327,10 @@ int rfc2231_encode_string (char **pd) for (s = *pd; *s; s++) if (*s & 0x80) break; - + if (!*s) return 0; - + if (!Charset || !SendCharset || !(charset = mutt_choose_charset (Charset, SendCharset, *pd, strlen (*pd), &d, &dlen))) @@ -375,9 +375,8 @@ int rfc2231_encode_string (char **pd) FREE (pd); /* __FREE_CHECKED__ */ *pd = d; } - + FREE (&charset); - + return encode; } - diff --git a/rfc2231.h b/rfc2231.h index 73019c24..b5f59c1e 100644 --- a/rfc2231.h +++ b/rfc2231.h @@ -21,4 +21,3 @@ void rfc2231_decode_parameters (PARAMETER **); int rfc2231_encode_string (char **); - diff --git a/rfc3676.c b/rfc3676.c index 529bd31e..5d126985 100644 --- a/rfc3676.c +++ b/rfc3676.c @@ -3,22 +3,22 @@ * Copyright (C) 2005 Peter J. Holzer * Copyright (C) 2005-2009 Rocco Rutte * Copyright (C) 2010 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ + */ /* This file was originally part of mutt-ng */ diff --git a/rfc3676.h b/rfc3676.h index 6f1a2a18..2e6ed7ca 100644 --- a/rfc3676.h +++ b/rfc3676.h @@ -2,22 +2,22 @@ * Copyright (C) 2005 Andreas Krennmair * Copyright (C) 2005 Peter J. Holzer * Copyright (C) 2005,2007 Rocco Rutte - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * - */ + */ /* This file was originally part of mutt-ng */ diff --git a/rfc822.c b/rfc822.c index 5b3f0b8f..40370701 100644 --- a/rfc822.c +++ b/rfc822.c @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 2011-2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -141,7 +141,7 @@ parse_comment (const char *s, char *comment, size_t *commentlen, size_t commentmax) { int level = 1; - + while (*s && level) { if (*s == '(') @@ -356,7 +356,7 @@ add_addrspec (ADDRESS **top, ADDRESS **last, const char *phrase, char *comment, size_t *commentlen, size_t commentmax) { ADDRESS *cur = rfc822_new_address (); - + if (parse_addr_spec (phrase, comment, commentlen, commentmax, cur) == NULL) { rfc822_free_address (&cur); @@ -380,7 +380,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s) char comment[LONG_STRING], phrase[LONG_STRING]; size_t phraselen = 0, commentlen = 0; ADDRESS *cur, *last = NULL; - + RFC822Error = 0; last = top; @@ -390,7 +390,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s) ws_pending = is_email_wsp (*s); if ((nl = mutt_strlen (s))) nl = s[nl - 1] == '\n'; - + s = skip_email_wsp(s); #ifdef EXACT_ADDRESS begin = s; @@ -536,7 +536,7 @@ ADDRESS *rfc822_parse_adrlist (ADDRESS *top, const char *s) ws_pending = is_email_wsp(*s); s = skip_email_wsp(s); } - + if (phraselen) { terminate_buffer (phrase, phraselen); @@ -603,7 +603,7 @@ void rfc822_write_address_single (char *buf, size_t buflen, ADDRESS *addr, size_t len; char *pbuf = buf; char *pc; - + if (!addr) return; @@ -739,7 +739,7 @@ int rfc822_write_address (char *buf, size_t buflen, ADDRESS *addr, int display) { char *pbuf = buf; size_t len = mutt_strlen (buf); - + buflen--; /* save room for the terminal nul */ if (len > 0) @@ -810,7 +810,7 @@ ADDRESS *rfc822_cpy_adr_real (ADDRESS *addr) ADDRESS *rfc822_cpy_adr (ADDRESS *addr, int prune) { ADDRESS *top = NULL, *last = NULL; - + for (; addr; addr = addr->next) { if (prune && addr->group && (!addr->next || !addr->next->mailbox)) @@ -907,7 +907,7 @@ int main (int argc, char **argv) # else char *str = "a b c "; # endif - + list = rfc822_parse_adrlist (NULL, str); buf[0] = 0; rfc822_write_address (buf, sizeof (buf), list); diff --git a/rfc822.h b/rfc822.h index deddd97a..f6825900 100644 --- a/rfc822.h +++ b/rfc822.h @@ -1,21 +1,21 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins * Copyright (C) 2012 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #ifndef rfc822_h #define rfc822_h diff --git a/safe_asprintf.c b/safe_asprintf.c index e92efc1b..18340d6c 100644 --- a/safe_asprintf.c +++ b/safe_asprintf.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2010 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #include #include "lib.h" @@ -92,4 +92,3 @@ int safe_asprintf (char **strp, const char *fmt, ...) /* not reached */ } #endif /* HAVE_ASPRINTF */ - diff --git a/score.c b/score.c index 1ac5e741..efcfd931 100644 --- a/score.c +++ b/score.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -148,7 +148,7 @@ void mutt_score_message (CONTEXT *ctx, HEADER *hdr, int upd_ctx) } if (hdr->score < 0) hdr->score = 0; - + if (hdr->score <= ScoreThresholdDelete) _mutt_set_flag (ctx, hdr, MUTT_DELETE, 1, upd_ctx); if (hdr->score <= ScoreThresholdRead) diff --git a/send.c b/send.c index 8d156450..7d5401e5 100644 --- a/send.c +++ b/send.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2002,2004,2010,2012-2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -150,7 +150,7 @@ static ADDRESS *remove_user (ADDRESS *a, int leave_only) else { ADDRESS *tmp = a; - + a = a->next; if (!leave_only || a || last) { @@ -192,7 +192,7 @@ static int edit_address (ADDRESS **a, /* const */ char *field) char buf[HUGE_STRING]; char *err = NULL; int idna_ok = 0; - + do { buf[0] = 0; @@ -209,7 +209,7 @@ static int edit_address (ADDRESS **a, /* const */ char *field) mutt_sleep (2); FREE (&err); } - } + } while (idna_ok != 0); return 0; } @@ -247,7 +247,7 @@ static int edit_envelope (ENVELOPE *en) } } } - + if (mutt_get_field (_("Subject: "), buf, sizeof (buf), 0) != 0 || (!buf[0] && query_quadoption (OPT_SUBJECT, _("No subject, abort?")) != MUTT_NO)) { @@ -357,7 +357,7 @@ void mutt_forward_trailer (CONTEXT *ctx, HEADER *cur, FILE *fp) static int include_forward (CONTEXT *ctx, HEADER *cur, FILE *out) { int chflags = CH_DECODE, cmflags = 0; - + mutt_parse_mime_message (ctx, cur); mutt_message_hook (ctx, cur, MUTT_MESSAGEHOOK); @@ -427,9 +427,9 @@ static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out) mutt_parse_mime_message (ctx, cur); mutt_message_hook (ctx, cur, MUTT_MESSAGEHOOK); - + mutt_make_attribution (ctx, cur, out); - + if (!option (OPTHEADER)) cmflags |= MUTT_CM_NOHEADER; if (option (OPTWEED)) @@ -441,7 +441,7 @@ static int include_reply (CONTEXT *ctx, HEADER *cur, FILE *out) mutt_copy_message (out, ctx, cur, cmflags, chflags); mutt_make_post_indent (ctx, cur, out); - + return 0; } @@ -449,7 +449,7 @@ static int default_to (ADDRESS **to, ENVELOPE *env, int flags, int hmfupto) { char prompt[STRING]; - if (flags && env->mail_followup_to && hmfupto == MUTT_YES) + if (flags && env->mail_followup_to && hmfupto == MUTT_YES) { rfc822_append (to, env->mail_followup_to, 1); return 0; @@ -477,15 +477,15 @@ static int default_to (ADDRESS **to, ENVELOPE *env, int flags, int hmfupto) { /* If the Reply-To: address is a mailing list, assume that it was * put there by the mailing list, and use the From: address - * + * * We also take the from header if our correspondent has a reply-to * header which is identical to the electronic mail address given * in his From header, and the reply-to has no display-name. - * + * */ rfc822_append (to, env->from, 0); } - else if (!(mutt_addrcmp (env->from, env->reply_to) && + else if (!(mutt_addrcmp (env->from, env->reply_to) && !env->reply_to->next) && quadoption (OPT_REPLYTO) != MUTT_YES) { @@ -498,7 +498,7 @@ static int default_to (ADDRESS **to, ENVELOPE *env, int flags, int hmfupto) Asks whether the user respects the reply-to header. If she says no, mutt will reply to the from header's address instead. */ snprintf (prompt, sizeof (prompt), _("Reply to %s%s?"), - env->reply_to->mailbox, + env->reply_to->mailbox, env->reply_to->next?",...":""); switch (query_quadoption (OPT_REPLYTO, prompt)) { @@ -574,7 +574,7 @@ LIST *mutt_make_references(ENVELOPE *e) l = mutt_copy_list (e->references); else l = mutt_copy_list (e->in_reply_to); - + if (e->message_id) { t = mutt_new_list(); @@ -582,7 +582,7 @@ LIST *mutt_make_references(ENVELOPE *e) t->next = l; l = t; } - + return l; } @@ -596,12 +596,12 @@ void mutt_fix_reply_recipients (ENVELOPE *env) env->cc = remove_user (env->cc, (env->to == NULL)); env->to = remove_user (env->to, (env->cc == NULL) || option (OPTREPLYSELF)); } - + /* the CC field can get cluttered, especially with lists */ env->to = mutt_remove_duplicates (env->to); env->cc = mutt_remove_duplicates (env->cc); env->cc = mutt_remove_xrefs (env->to, env->cc); - + if (env->cc && !env->to) { env->to = env->cc; @@ -640,38 +640,38 @@ void mutt_add_to_reference_headers (ENVELOPE *env, ENVELOPE *curenv, LIST ***pp, if (pp) p = *pp; if (qq) q = *qq; - + if (!p) p = &env->references; if (!q) q = &env->in_reply_to; - + while (*p) p = &(*p)->next; while (*q) q = &(*q)->next; - + *p = mutt_make_references (curenv); - + if (curenv->message_id) { *q = mutt_new_list(); (*q)->data = safe_strdup (curenv->message_id); } - + if (pp) *pp = p; if (qq) *qq = q; - + } -static void +static void mutt_make_reference_headers (ENVELOPE *curenv, ENVELOPE *env, CONTEXT *ctx) { env->references = NULL; env->in_reply_to = NULL; - + if (!curenv) { HEADER *h; LIST **p = NULL, **q = NULL; int i; - + for(i = 0; i < ctx->vcount; i++) { h = ctx->hdrs[ctx->v2r[i]]; @@ -799,7 +799,7 @@ generate_body (FILE *tempfp, /* stream for outgoing message */ BODY *last = msg->content; mutt_message _("Preparing forwarded message..."); - + while (last && last->next) last = last->next; @@ -842,7 +842,7 @@ generate_body (FILE *tempfp, /* stream for outgoing message */ return -1; } /* if (WithCrypto && (flags & SENDKEY)) */ - else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)) + else if ((WithCrypto & APPLICATION_PGP) && (flags & SENDKEY)) { BODY *tmp; @@ -864,7 +864,7 @@ void mutt_set_followup_to (ENVELOPE *e) ADDRESS *t = NULL; ADDRESS *from; - /* + /* * Only generate the Mail-Followup-To if the user has requested it, and * it hasn't already been set */ @@ -873,7 +873,7 @@ void mutt_set_followup_to (ENVELOPE *e) { if (mutt_is_list_cc (0, e->to, e->cc)) { - /* + /* * this message goes to known mailing lists, so create a proper * mail-followup-to header */ @@ -887,7 +887,7 @@ void mutt_set_followup_to (ENVELOPE *e) /* * If we are not subscribed to any of the lists in question, - * re-add ourselves to the mail-followup-to header. The + * re-add ourselves to the mail-followup-to header. The * mail-followup-to header generated is a no-op with group-reply, * but makes sure list-reply has the desired effect. */ @@ -900,20 +900,20 @@ void mutt_set_followup_to (ENVELOPE *e) from = rfc822_cpy_adr (e->from, 0); else from = mutt_default_from (); - + if (from) { /* Normally, this loop will not even be entered. */ for (t = from; t && t->next; t = t->next) ; - + t->next = e->mail_followup_to; /* t cannot be NULL at this point. */ e->mail_followup_to = from; } } - + e->mail_followup_to = mutt_remove_duplicates (e->mail_followup_to); - + } } @@ -957,9 +957,9 @@ ADDRESS *mutt_default_from (void) ADDRESS *adr; const char *fqdn = mutt_fqdn(1); - /* + /* * Note: We let $from override $realname here. Is this the right - * thing to do? + * thing to do? */ if (From) @@ -975,19 +975,19 @@ ADDRESS *mutt_default_from (void) adr = rfc822_new_address (); adr->mailbox = safe_strdup (NONULL(Username)); } - + return (adr); } static int send_message (HEADER *msg) -{ +{ char tempfile[_POSIX_PATH_MAX]; FILE *tempfp; int i; #ifdef USE_SMTP short old_write_bcc; #endif - + /* Write out the message in MIME form. */ mutt_mktemp (tempfile, sizeof (tempfile)); if ((tempfp = safe_fopen (tempfile, "w")) == NULL) @@ -1012,7 +1012,7 @@ static int send_message (HEADER *msg) if (old_write_bcc) set_option (OPTWRITEBCC); #endif - + fputc ('\n', tempfp); /* tie off the header. */ if ((mutt_write_mime_body (msg->content, tempfp) == -1)) @@ -1021,7 +1021,7 @@ static int send_message (HEADER *msg) unlink (tempfile); return (-1); } - + if (fclose (tempfp) != 0) { mutt_perror (tempfile); @@ -1041,7 +1041,7 @@ static int send_message (HEADER *msg) (msg->content->encoding == ENC8BIT)); #endif /* USE_SMTP */ - i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc, + i = mutt_invoke_sendmail (msg->env->from, msg->env->to, msg->env->cc, msg->env->bcc, tempfile, (msg->content->encoding == ENC8BIT)); return (i); @@ -1223,7 +1223,7 @@ void mutt_encode_descriptions (BODY *b, short recurse) static void decode_descriptions (BODY *b) { BODY *t; - + for (t = b; t; t = t->next) { if (t->description) @@ -1239,7 +1239,7 @@ static void fix_end_of_file (const char *data) { FILE *fp; int c; - + if ((fp = safe_fopen (data, "a+")) == NULL) return; fseek (fp,-1,SEEK_END); @@ -1251,7 +1251,7 @@ static void fix_end_of_file (const char *data) int mutt_resend_message (FILE *fp, CONTEXT *ctx, HEADER *cur) { HEADER *msg = mutt_new_header (); - + if (mutt_prepare_template (fp, ctx, msg, cur, 1) < 0) return -1; @@ -1440,7 +1440,7 @@ ci_send_message (int flags, /* send mode */ char *ctype; int rv = -1; - + if (!flags && !msg && quadoption (OPT_RECALL) != MUTT_NO && mutt_num_postponed (1)) { @@ -1453,8 +1453,8 @@ ci_send_message (int flags, /* send mode */ if(i == MUTT_YES) flags |= SENDPOSTPONED; } - - + + if (flags & SENDPOSTPONED) { if (WithCrypto & APPLICATION_PGP) @@ -1495,15 +1495,15 @@ ci_send_message (int flags, /* send mode */ } /* Parse and use an eventual list-post header */ - if ((flags & SENDLISTREPLY) - && cur && cur->env && cur->env->list_post) + if ((flags & SENDLISTREPLY) + && cur && cur->env && cur->env->list_post) { /* Use any list-post header as a template */ url_parse_mailto (msg->env, NULL, cur->env->list_post); /* We don't let them set the sender's address. */ rfc822_free_address (&msg->env->from); } - + if (! (flags & (SENDKEY | SENDPOSTPONED | SENDRESEND))) { /* When SENDDRAFTFILE is set, the caller has already @@ -1576,7 +1576,7 @@ ci_send_message (int flags, /* send mode */ /* Expand aliases and remove duplicates/crossrefs */ mutt_expand_aliases_env (msg->env); - + if (flags & SENDREPLY) mutt_fix_reply_recipients (msg->env); @@ -1613,7 +1613,7 @@ ci_send_message (int flags, /* send mode */ } /* change settings based upon recipients */ - + mutt_message_hook (NULL, msg, MUTT_SENDHOOK); /* @@ -1658,8 +1658,8 @@ ci_send_message (int flags, /* send mode */ && Editor && mutt_strcmp (Editor, "builtin") != 0) append_signature (tempfp); } - - /* + + /* * This hook is even called for postponed messages, and can, e.g., be * used for setting the editor, the sendmail path, or the * envelope sender. @@ -1727,7 +1727,7 @@ ci_send_message (int flags, /* send mode */ else mutt_perror (msg->content->filename); } - + /* If using format=flowed, perform space stuffing. Avoid stuffing when * recalling a postponed message where the stuffing was already * performed. If it has already been performed, the format=flowed @@ -1760,7 +1760,7 @@ ci_send_message (int flags, /* send mode */ } } - /* + /* * Set the message security unless: * 1) crypto support is not enabled (WithCrypto==0) * 2) pgp: header field was present during message editing with $edit_headers (msg->security != 0) @@ -1795,18 +1795,18 @@ ci_send_message (int flags, /* send mode */ if (msg->security || option (OPTCRYPTOPPORTUNISTICENCRYPT)) { - /* + /* * When replying / forwarding, use the original message's * crypto system. According to the documentation, * smime_is_default should be disregarded here. - * + * * Problem: At least with forwarding, this doesn't really * make much sense. Should we have an option to completely * disable individual mechanisms at run-time? */ if (cur) { - if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP) + if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP) && (cur->security & APPLICATION_PGP)) msg->security |= APPLICATION_PGP; else if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME) @@ -1816,11 +1816,11 @@ ci_send_message (int flags, /* send mode */ /* * No crypto mechanism selected? Use availability + smime_is_default - * for the decision. + * for the decision. */ if (!(msg->security & (APPLICATION_SMIME | APPLICATION_PGP))) { - if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME) + if ((WithCrypto & APPLICATION_SMIME) && option (OPTCRYPTAUTOSMIME) && option (OPTSMIMEISDEFAULT)) msg->security |= APPLICATION_SMIME; else if ((WithCrypto & APPLICATION_PGP) && option (OPTCRYPTAUTOPGP)) @@ -1881,7 +1881,7 @@ ci_send_message (int flags, /* send mode */ } } - + mutt_update_encoding (msg->content); if (! (flags & (SENDMAILX | SENDBATCH))) @@ -1928,10 +1928,10 @@ main_loop: FREE (&err); if (!(flags & SENDBATCH)) goto main_loop; - else + else goto cleanup; } - + if (!msg->env->subject && ! (flags & SENDBATCH) && (i = query_quadoption (OPT_SUBJECT, _("No subject, abort sending?"))) != MUTT_NO) { @@ -1962,45 +1962,45 @@ main_loop: if (msg->content->next) msg->content = mutt_make_multipart (msg->content); - /* + /* * Ok, we need to do it this way instead of handling all fcc stuff in * one place in order to avoid going to main_loop with encoded "env" * in case of error. Ugh. */ mutt_encode_descriptions (msg->content, 1); - + /* * Make sure that clear_content and free_clear_content are * properly initialized -- we may visit this particular place in * the code multiple times, including after a failed call to * mutt_protect(). */ - + clear_content = NULL; free_clear_content = 0; - + if (WithCrypto) { if (msg->security & (ENCRYPT | SIGN)) { /* save the decrypted attachments */ clear_content = msg->content; - + if ((crypt_get_keys (msg, &pgpkeylist, 0) == -1) || mutt_protect (msg, pgpkeylist) == -1) { msg->content = mutt_remove_multipart (msg->content); - + FREE (&pgpkeylist); - + decode_descriptions (msg->content); goto main_loop; } mutt_encode_descriptions (msg->content, 0); } - - /* + + /* * at this point, msg->content is one of the following three things: * - multipart/signed. In this case, clear_content is a child. * - multipart/encrypted. In this case, clear_content exists @@ -2008,9 +2008,9 @@ main_loop: * - application/pgp. In this case, clear_content exists independently. * - something else. In this case, it's the same as clear_content. */ - + /* This is ugly -- lack of "reporting back" from mutt_protect(). */ - + if (clear_content && (msg->content != clear_content) && (msg->content->parts != clear_content)) free_clear_content = 1; @@ -2027,7 +2027,7 @@ main_loop: { if (!WithCrypto) ; - else if ((msg->security & ENCRYPT) || + else if ((msg->security & ENCRYPT) || ((msg->security & SIGN) && msg->content->type == TYPEAPPLICATION)) { @@ -2037,7 +2037,7 @@ main_loop: else if ((msg->security & SIGN) && msg->content->type == TYPEMULTIPART) { mutt_free_body (&msg->content->parts->next); /* destroy sig */ - msg->content = mutt_remove_multipart (msg->content); + msg->content = mutt_remove_multipart (msg->content); } FREE (&pgpkeylist); @@ -2083,7 +2083,7 @@ main_loop: rv = 0; - + cleanup: if (flags & SENDPOSTPONED) @@ -2099,11 +2099,11 @@ cleanup: SmimeSignAs = smime_signas; } } - + safe_fclose (&tempfp); if (! (flags & SENDNOFREEHEADER)) mutt_free_header (&msg); - + return rv; } diff --git a/signal.c b/signal.c index b471944c..622527ad 100644 --- a/signal.c +++ b/signal.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2012 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -242,7 +242,7 @@ void mutt_unblock_signals_system (int catch) void mutt_allow_interrupt (int disposition) { struct sigaction sa; - + memset (&sa, 0, sizeof sa); sa.sa_handler = sighandler; #ifdef SA_RESTART diff --git a/smime.c b/smime.c index 01d4326f..cd1a7c87 100644 --- a/smime.c +++ b/smime.c @@ -7,12 +7,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -137,7 +137,7 @@ int smime_valid_passphrase (void) return 1; smime_void_passphrase(); - + if (mutt_get_password (_("Enter S/MIME passphrase:"), SmimePass, sizeof (SmimePass)) == 0) { SmimeExptime = mutt_add_timeout (time (NULL), SmimeTimeout); @@ -171,7 +171,7 @@ static const char *_mutt_fmt_smime_command (char *dest, char fmt[16]; struct smime_command_context *cctx = (struct smime_command_context *) data; int optional = (flags & MUTT_FORMAT_OPTIONAL); - + switch (op) { case 'C': @@ -190,7 +190,7 @@ static const char *_mutt_fmt_smime_command (char *dest, snprintf (buf2, sizeof (buf2), "-CAfile %s", buf1); else snprintf (buf2, sizeof (buf2), "-CApath %s", buf1); - + snprintf (fmt, sizeof (fmt), "%%%ss", prefix); snprintf (dest, destlen, fmt, buf2); } @@ -198,7 +198,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'c': { /* certificate (list) */ if (!optional) { @@ -209,7 +209,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'i': { /* intermediate certificates */ if (!optional) { @@ -220,7 +220,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 's': { /* detached signature */ if (!optional) @@ -232,7 +232,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'k': { /* private key */ if (!optional) @@ -244,7 +244,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'a': { /* algorithm for encryption */ if (!optional) { @@ -255,7 +255,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'f': { /* file to process */ if (!optional) @@ -267,7 +267,7 @@ static const char *_mutt_fmt_smime_command (char *dest, optional = 0; break; } - + case 'd': { /* algorithm for the signature message digest */ if (!optional) { @@ -320,12 +320,12 @@ static pid_t smime_invoke (FILE **smimein, FILE **smimeout, FILE **smimeerr, { struct smime_command_context cctx; char cmd[HUGE_STRING]; - + memset (&cctx, 0, sizeof (cctx)); if (!format || !*format) return (pid_t) -1; - + cctx.fname = fname; cctx.sig_fname = sig_fname; cctx.key = key; @@ -333,7 +333,7 @@ static pid_t smime_invoke (FILE **smimein, FILE **smimeout, FILE **smimeerr, cctx.digestalg = digestalg; cctx.certificates = certificates; cctx.intermediates = intermediates; - + mutt_smime_command (cmd, sizeof (cmd), &cctx, format); return mutt_create_filter_fd (cmd, smimein, smimeout, smimeerr, @@ -779,7 +779,7 @@ smime_key_t *smime_ask_for_key(char *prompt, short abilities, short public) -/* +/* This sets the '*ToUse' variables for an upcoming decryption, where the required key is different from SmimeDefaultKey. */ @@ -804,7 +804,7 @@ void _smime_getkeys (char *mailbox) k = key->hash; /* the key used last time. */ - if (*SmimeKeyToUse && + if (*SmimeKeyToUse && !mutt_strcasecmp (k, SmimeKeyToUse + mutt_strlen (SmimeKeys)+1)) { smime_free_key (&key); @@ -812,9 +812,9 @@ void _smime_getkeys (char *mailbox) } else smime_void_passphrase (); - snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", + snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", NONULL(SmimeKeys), k); - + snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s", NONULL(SmimeCertificates), k); @@ -827,16 +827,16 @@ void _smime_getkeys (char *mailbox) if (*SmimeKeyToUse) { - if (!mutt_strcasecmp (SmimeDefaultKey, + if (!mutt_strcasecmp (SmimeDefaultKey, SmimeKeyToUse + mutt_strlen (SmimeKeys)+1)) return; smime_void_passphrase (); } - snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", + snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", NONULL (SmimeKeys), NONULL (SmimeDefaultKey)); - + snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s", NONULL (SmimeCertificates), NONULL (SmimeDefaultKey)); } @@ -848,9 +848,9 @@ void smime_getkeys (ENVELOPE *env) if (option (OPTSDEFAULTDECRYPTKEY) && SmimeDefaultKey && *SmimeDefaultKey) { - snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", + snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", NONULL (SmimeKeys), SmimeDefaultKey); - + snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s", NONULL(SmimeCertificates), SmimeDefaultKey); @@ -1080,7 +1080,7 @@ static char *smime_extract_certificate (char *infile) safe_fclose (&fperr); mutt_unlink (pk7out); return NULL; - + } @@ -1093,7 +1093,7 @@ static char *smime_extract_certificate (char *infile) mutt_perror (certfile); return NULL; } - + /* Step 2: Extract the certificates from a PKCS#7 structure. */ if ((thepid = smime_invoke (NULL, NULL, NULL, @@ -1158,7 +1158,7 @@ static char *smime_extract_signer_certificate (char *infile) mutt_perror (certfile); return NULL; } - + /* Extract signer's certificate */ if ((thepid = smime_invoke (NULL, NULL, NULL, @@ -1235,7 +1235,7 @@ void smime_invoke_import (char *infile, char *mailbox) if ((certfile = smime_extract_certificate(infile))) { mutt_endwin (NULL); - + if ((thepid = smime_invoke (&smimein, NULL, NULL, -1, fileno(fpout), fileno(fperr), certfile, NULL, NULL, NULL, NULL, NULL, NULL, @@ -1249,7 +1249,7 @@ void smime_invoke_import (char *infile, char *mailbox) safe_fclose (&smimein); mutt_wait_filter (thepid); - + mutt_unlink (certfile); FREE (&certfile); } @@ -1294,13 +1294,13 @@ int smime_verify_sender(HEADER *h) if (h->env->from) { - h->env->from = mutt_expand_aliases (h->env->from); - mbox = h->env->from->mailbox; + h->env->from = mutt_expand_aliases (h->env->from); + mbox = h->env->from->mailbox; } else if (h->env->sender) { - h->env->sender = mutt_expand_aliases (h->env->sender); - mbox = h->env->sender->mailbox; + h->env->sender = mutt_expand_aliases (h->env->sender); + mbox = h->env->sender->mailbox; } if (mbox) @@ -1318,10 +1318,10 @@ int smime_verify_sender(HEADER *h) mutt_unlink(certfile); FREE (&certfile); } - else + else mutt_any_key_to_continue(_("no certfile")); } - else + else mutt_any_key_to_continue(_("no mbox")); mutt_unlink(tempfname); @@ -1357,7 +1357,7 @@ pid_t smime_invoke_encrypt (FILE **smimein, FILE **smimeout, FILE **smimeerr, static pid_t smime_invoke_sign (FILE **smimein, FILE **smimeout, FILE **smimeerr, - int smimeinfd, int smimeoutfd, int smimeerrfd, + int smimeinfd, int smimeoutfd, int smimeerrfd, const char *fname) { return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd, @@ -1379,7 +1379,7 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist) BODY *t; int err = 0, empty, off; pid_t thepid; - + mutt_mktemp (tempfile, sizeof (tempfile)); if ((fpout = safe_fopen (tempfile, "w+")) == NULL) { @@ -1396,7 +1396,7 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist) return NULL; } mutt_unlink (smimeerrfile); - + mutt_mktemp (smimeinfile, sizeof (smimeinfile)); if ((fptmp = safe_fopen (smimeinfile, "w+")) == NULL) { @@ -1441,15 +1441,15 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist) } safe_fclose (&smimein); - + mutt_wait_filter (thepid); mutt_unlink (smimeinfile); - + fflush (fpout); rewind (fpout); empty = (fgetc (fpout) == EOF); safe_fclose (&fpout); - + fflush (smimeerr); rewind (smimeerr); while (fgets (buf, sizeof (buf) - 1, smimeerr) != NULL) @@ -1484,7 +1484,7 @@ BODY *smime_build_smime_entity (BODY *a, char *certlist) t->unlink = 1; /*delete after sending the message */ t->parts=0; t->next=0; - + return (t); } @@ -1556,20 +1556,20 @@ BODY *smime_sign_message (BODY *a ) mutt_unlink (filetosign); return NULL; } - + mutt_write_mime_header (a, sfp); fputc ('\n', sfp); mutt_write_mime_body (a, sfp); safe_fclose (&sfp); - - snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", + + snprintf (SmimeKeyToUse, sizeof (SmimeKeyToUse), "%s/%s", NONULL(SmimeKeys), signas); snprintf (SmimeCertToUse, sizeof (SmimeCertToUse), "%s/%s", NONULL(SmimeCertificates), signas); - + signas_key = smime_get_key_by_hash (signas, 1); if ((! signas_key) || (! mutt_strcmp ("?", signas_key->issuer))) @@ -1581,7 +1581,7 @@ BODY *smime_sign_message (BODY *a ) NONULL(SmimeCertificates), intermediates); smime_free_key (&signas_key); - + if ((thepid = smime_invoke_sign (&smimein, NULL, &smimeerr, @@ -1596,7 +1596,7 @@ BODY *smime_sign_message (BODY *a ) fputs (SmimePass, smimein); fputc ('\n', smimein); safe_fclose (&smimein); - + mutt_wait_filter (thepid); @@ -1618,7 +1618,7 @@ BODY *smime_sign_message (BODY *a ) safe_fclose (&smimeout); mutt_unlink (filetosign); - + if (err) mutt_any_key_to_continue (NULL); @@ -1680,7 +1680,7 @@ BODY *smime_sign_message (BODY *a ) static pid_t smime_invoke_verify (FILE **smimein, FILE **smimeout, FILE **smimeerr, - int smimeinfd, int smimeoutfd, int smimeerrfd, + int smimeinfd, int smimeoutfd, int smimeerrfd, const char *fname, const char *sig_fname, int opaque) { return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd, @@ -1691,7 +1691,7 @@ pid_t smime_invoke_verify (FILE **smimein, FILE **smimeout, FILE **smimeerr, static pid_t smime_invoke_decrypt (FILE **smimein, FILE **smimeout, FILE **smimeerr, - int smimeinfd, int smimeoutfd, int smimeerrfd, + int smimeinfd, int smimeoutfd, int smimeerrfd, const char *fname) { return smime_invoke (smimein, smimeout, smimeerr, smimeinfd, smimeoutfd, @@ -1715,7 +1715,7 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) snprintf (signedfile, sizeof (signedfile), "%s.sig", tempfile); - + /* decode to a tempfile, saving the original destination */ fp = s->fpout; if ((s->fpout = safe_fopen (signedfile, "w")) == NULL) @@ -1748,10 +1748,10 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) /* restore the prefix */ s->prefix = savePrefix; - + sigbdy->type = origType; - + mutt_mktemp (smimeerrfile, sizeof (smimeerrfile)); if (!(smimeerr = safe_fopen (smimeerrfile, "w+"))) { @@ -1759,16 +1759,16 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) mutt_unlink (signedfile); return -1; } - + crypt_current_time (s, "OpenSSL"); - - if ((thepid = smime_invoke_verify (NULL, &smimeout, NULL, + + if ((thepid = smime_invoke_verify (NULL, &smimeout, NULL, -1, -1, fileno (smimeerr), tempfile, signedfile, 0)) != -1) { fflush (smimeout); safe_fclose (&smimeout); - + if (mutt_wait_filter (thepid)) badsig = -1; else @@ -1776,10 +1776,10 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) char *line = NULL; int lineno = 0; size_t linelen; - + fflush (smimeerr); rewind (smimeerr); - + line = mutt_read_line (line, &linelen, smimeerr, &lineno, 0); if (linelen && !ascii_strcasecmp (line, "verification successful")) badsig = 0; @@ -1787,24 +1787,24 @@ int smime_verify_one (BODY *sigbdy, STATE *s, const char *tempfile) FREE (&line); } } - + fflush (smimeerr); rewind (smimeerr); mutt_copy_stream (smimeerr, s->fpout); safe_fclose (&smimeerr); - + state_attach_puts (_("[-- End of OpenSSL output --]\n\n"), s); - + mutt_unlink (signedfile); mutt_unlink (smimeerrfile); sigbdy->length = tmplength; sigbdy->offset = tmpoffset; - + /* restore the original source stream */ safe_fclose (&s->fpin); s->fpin = fp; - + return badsig; } @@ -2069,7 +2069,7 @@ int smime_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur) if (b->parts) return -1; - + memset (&s, 0, sizeof (s)); s.fpin = fpin; fseeko (s.fpin, b->offset, 0); @@ -2105,7 +2105,7 @@ int smime_decrypt_mime (FILE *fpin, FILE **fpout, BODY *b, BODY **cur) rv = -1; goto bail; } - + (*cur)->goodsig = b->goodsig; (*cur)->badsig = b->badsig; @@ -2116,7 +2116,7 @@ bail: safe_fclose (&tmpfp); if (*fpout) rewind (*fpout); - + return rv; } @@ -2274,7 +2274,7 @@ int smime_send_menu (HEADER *msg) case 'a': /* sign (a)s */ - if ((key = smime_ask_for_key (_("Sign as: "), KEYFLAG_CANSIGN, 0))) + if ((key = smime_ask_for_key (_("Sign as: "), KEYFLAG_CANSIGN, 0))) { mutt_str_replace (&SmimeSignAs, key->hash); smime_free_key (&key); diff --git a/smime.h b/smime.h index 3eb4c652..853f2b3f 100644 --- a/smime.h +++ b/smime.h @@ -6,12 +6,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. @@ -66,5 +66,3 @@ void smime_invoke_import (char *, char *); int smime_send_menu (HEADER *msg); #endif - - diff --git a/smtp.c b/smtp.c index fb4fd125..afd90659 100644 --- a/smtp.c +++ b/smtp.c @@ -526,7 +526,7 @@ static int smtp_auth (CONNECTION* conn) { r = smtp_auth_oauth (conn); } - else + else { #ifdef USE_SASL r = smtp_auth_sasl (conn, method); @@ -706,7 +706,7 @@ static int smtp_auth_oauth (CONNECTION* conn) if (rc == -1) return SMTP_AUTH_FAIL; - if (smtp_get_resp (conn) != 0) + if (smtp_get_resp (conn) != 0) return SMTP_AUTH_FAIL; return SMTP_AUTH_SUCCESS; diff --git a/snprintf.c b/snprintf.c index cd2e3852..429abfca 100644 --- a/snprintf.c +++ b/snprintf.c @@ -28,9 +28,9 @@ * original. Also, there is now a builtin-test, just compile with: * gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm * and run snprintf for results. - * + * * Thomas Roessler 01/27/98 for mutt 0.89i - * The PGP code was using unsigned hexadecimal formats. + * The PGP code was using unsigned hexadecimal formats. * Unfortunately, unsigned formats simply didn't work. * * Michael Elkins 03/05/98 for mutt 0.90.8 @@ -86,7 +86,7 @@ /*int snprintf (char *str, size_t count, const char *fmt, ...);*/ /*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/ -static int dopr (char *buffer, size_t maxlen, const char *format, +static int dopr (char *buffer, size_t maxlen, const char *format, va_list args); static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, char *value, int flags, int min, int max); @@ -141,7 +141,7 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) int flags; int cflags; size_t currlen; - + state = DP_S_DEFAULT; currlen = flags = cflags = min = 0; max = -1; @@ -152,17 +152,17 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) if (ch == '\0') state = DP_S_DONE; - switch(state) + switch(state) { case DP_S_DEFAULT: - if (ch == '%') + if (ch == '%') state = DP_S_FLAGS; - else + else dopr_outch (buffer, &currlen, maxlen, ch); ch = *format++; break; case DP_S_FLAGS: - switch (ch) + switch (ch) { case '-': flags |= DP_F_MINUS; @@ -190,48 +190,48 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) } break; case DP_S_MIN: - if (isdigit((unsigned char)ch)) + if (isdigit((unsigned char)ch)) { min = 10*min + char_to_int (ch); ch = *format++; - } - else if (ch == '*') + } + else if (ch == '*') { min = va_arg (args, int); ch = *format++; state = DP_S_DOT; - } - else + } + else state = DP_S_DOT; break; case DP_S_DOT: - if (ch == '.') + if (ch == '.') { state = DP_S_MAX; ch = *format++; - } - else + } + else state = DP_S_MOD; break; case DP_S_MAX: - if (isdigit((unsigned char)ch)) + if (isdigit((unsigned char)ch)) { if (max < 0) max = 0; max = 10*max + char_to_int (ch); ch = *format++; - } - else if (ch == '*') + } + else if (ch == '*') { max = va_arg (args, int); ch = *format++; state = DP_S_MOD; - } - else + } + else state = DP_S_MOD; break; case DP_S_MOD: - switch (ch) + switch (ch) { case 'h': cflags = DP_C_SHORT; @@ -256,11 +256,11 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) state = DP_S_CONV; break; case DP_S_CONV: - switch (ch) + switch (ch) { case 'd': case 'i': - if (cflags == DP_C_SHORT) + if (cflags == DP_C_SHORT) value = va_arg (args, short int); else if (cflags == DP_C_LONG) value = va_arg (args, long int); @@ -345,25 +345,25 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) fmtint (buffer, &currlen, maxlen, (long) strvalue, 16, min, max, flags); break; case 'n': - if (cflags == DP_C_SHORT) + if (cflags == DP_C_SHORT) { short int *num; num = va_arg (args, short int *); *num = currlen; - } - else if (cflags == DP_C_LONG) + } + else if (cflags == DP_C_LONG) { long int *num; num = va_arg (args, long int *); *num = currlen; - } - else if (cflags == DP_C_LONGLONG) + } + else if (cflags == DP_C_LONGLONG) { long long int *num; num = va_arg (args, long long int *); *num = currlen; - } - else + } + else { int *num; num = va_arg (args, int *); @@ -393,9 +393,9 @@ static int dopr (char *buffer, size_t maxlen, const char *format, va_list args) break; /* some picky compilers need this */ } } - if (currlen < maxlen - 1) + if (currlen < maxlen - 1) buffer[currlen] = '\0'; - else + else buffer[maxlen - 1] = '\0'; return (int)currlen; @@ -406,7 +406,7 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, { int padlen, strln; /* amount to pad */ int cnt = 0; - + if (!value) { value = ""; @@ -414,23 +414,23 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, for (strln = 0; value[strln]; ++strln); /* strlen */ padlen = min - strln; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justify */ - while ((padlen > 0) && (max == -1 || cnt < max)) + while ((padlen > 0) && (max == -1 || cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; ++cnt; } - while (*value && (max == -1 || cnt < max)) + while (*value && (max == -1 || cnt < max)) { dopr_outch (buffer, currlen, maxlen, *value++); ++cnt; } - while ((padlen < 0) && (max == -1 || cnt < max)) + while ((padlen < 0) && (max == -1 || cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; @@ -450,7 +450,7 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, int spadlen = 0; /* amount to space pad */ int zpadlen = 0; /* amount to zero pad */ int caps = 0; - + if (max < 0) max = 0; @@ -469,7 +469,7 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, if (flags & DP_F_SPACE) signvalue = ' '; } - + if (flags & DP_F_UP) caps = 1; /* Should characters be upper case? */ do { @@ -490,7 +490,7 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, zpadlen = MAX(zpadlen, spadlen); spadlen = 0; } - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) spadlen = -spadlen; /* Left Justifty */ #ifdef DEBUG_SNPRINTF @@ -499,18 +499,18 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, #endif /* Spaces */ - while (spadlen > 0) + while (spadlen > 0) { dopr_outch (buffer, currlen, maxlen, ' '); --spadlen; } /* Sign */ - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); /* Zeros */ - if (zpadlen > 0) + if (zpadlen > 0) { while (zpadlen > 0) { @@ -520,9 +520,9 @@ static void fmtint (char *buffer, size_t *currlen, size_t maxlen, } /* Digits */ - while (place > 0) + while (place > 0) dopr_outch (buffer, currlen, maxlen, convert[--place]); - + /* Left Justified spaces */ while (spadlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); @@ -549,7 +549,7 @@ static long double pow10 (int exp) result *= 10; exp--; } - + return result; } @@ -575,12 +575,12 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, int iplace = 0; int fplace = 0; int padlen = 0; /* amount to pad */ - int zpadlen = 0; + int zpadlen = 0; int caps = 0; long intpart; long fracpart; - - /* + + /* * AIX manpage says the default is 0, but Solaris says the default * is 6, and sprintf on AIX defaults to 6 */ @@ -604,8 +604,8 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, intpart = ufvalue; - /* - * Sorry, we only support 9 digits past the decimal because of our + /* + * Sorry, we only support 9 digits past the decimal because of our * conversion method */ if (max > 9) @@ -645,18 +645,18 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, fconvert[fplace] = 0; /* -1 for decimal point, another -1 if we are printing a sign */ - padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); + padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0); zpadlen = max - fplace; if (zpadlen < 0) zpadlen = 0; - if (padlen < 0) + if (padlen < 0) padlen = 0; - if (flags & DP_F_MINUS) + if (flags & DP_F_MINUS) padlen = -padlen; /* Left Justifty */ - if ((flags & DP_F_ZERO) && (padlen > 0)) + if ((flags & DP_F_ZERO) && (padlen > 0)) { - if (signvalue) + if (signvalue) { dopr_outch (buffer, currlen, maxlen, signvalue); --padlen; @@ -673,10 +673,10 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, dopr_outch (buffer, currlen, maxlen, ' '); --padlen; } - if (signvalue) + if (signvalue) dopr_outch (buffer, currlen, maxlen, signvalue); - while (iplace > 0) + while (iplace > 0) dopr_outch (buffer, currlen, maxlen, iconvert[--iplace]); /* @@ -685,7 +685,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, */ dopr_outch (buffer, currlen, maxlen, '.'); - while (fplace > 0) + while (fplace > 0) dopr_outch (buffer, currlen, maxlen, fconvert[--fplace]); while (zpadlen > 0) @@ -694,7 +694,7 @@ static void fmtfp (char *buffer, size_t *currlen, size_t maxlen, --zpadlen; } - while (padlen < 0) + while (padlen < 0) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; @@ -732,7 +732,7 @@ int snprintf (va_alist) va_dcl #endif int len; VA_LOCAL_DECL; - + VA_START (fmt); VA_SHIFT (str, char *); VA_SHIFT (count, size_t ); @@ -764,7 +764,7 @@ int main (void) "%3.2f", NULL }; - double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, + double fp_nums[] = { -1.5, 134.21, 91340.2, 341.1234, 0203.9, 0.96, 0.996, 0.9996, 1.996, 4.136, 0}; char *int_fmt[] = { "%-1.5d", diff --git a/sort.c b/sort.c index 9ed5386a..47dada8a 100644 --- a/sort.c +++ b/sort.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -277,7 +277,7 @@ void mutt_sort_headers (CONTEXT *ctx, int init) HEADER *h; THREAD *thread, *top; sort_t *sortfunc; - + unset_option (OPTNEEDRESORT); if (!ctx) @@ -337,7 +337,7 @@ void mutt_sort_headers (CONTEXT *ctx, int init) mutt_sleep (1); return; } - else + else qsort ((void *) ctx->hdrs, ctx->msgcount, sizeof (HEADER *), sortfunc); /* adjust the virtual message numbers */ diff --git a/sort.h b/sort.h index b5bf9c87..0a6450e9 100644 --- a/sort.h +++ b/sort.h @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #define SORT_DATE 1 /* the date the mail was sent. */ #define SORT_SIZE 2 diff --git a/status.c b/status.c index a069072f..364c3fa7 100644 --- a/status.c +++ b/status.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2007 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -60,7 +60,7 @@ static void _menu_status_line (char *buf, size_t buflen, size_t col, int cols, M * %S = current aux sorting method ($sort_aux) * %t = # of tagged messages [option] * %u = number of unread messages [option] - * %v = Mutt version + * %v = Mutt version * %V = currently active limit pattern [option] */ static const char * status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, const char *src, @@ -228,7 +228,7 @@ status_format_str (char *buf, size_t buflen, size_t col, int cols, char op, cons (Context->magic != MUTT_IMAP && Context->deleted)) ? 1 : 0); } - + if (!StChars || !StChars->len) buf[0] = 0; else if (i >= StChars->len) diff --git a/strcasecmp.c b/strcasecmp.c index 51e6e101..d8bfbc08 100644 --- a/strcasecmp.c +++ b/strcasecmp.c @@ -6,7 +6,7 @@ int strncasecmp (char *s1, char *s2, size_t n) { register int c1, c2, l = 0; - + while (*s1 && *s2 && l < n) { c1 = tolower ((unsigned char) *s1); @@ -26,7 +26,7 @@ int strncasecmp (char *s1, char *s2, size_t n) int strcasecmp (char *s1, char *s2) { register int c1, c2; - + while (*s1 && *s2) { c1 = tolower ((unsigned char) *s1); @@ -35,6 +35,6 @@ int strcasecmp (char *s1, char *s2) return (c1 - c2); s1++; s2++; - } + } return (int) (*s1 - *s2); } diff --git a/strdup.c b/strdup.c index 0249a058..926ad43c 100644 --- a/strdup.c +++ b/strdup.c @@ -6,14 +6,13 @@ char *strdup (const char *s) /* __MEM_CHECKED__ */ { char *d; - + if (s == NULL) return NULL; - + if ((d = malloc (strlen (s) + 1)) == NULL) /* __MEM_CHECKED__ */ return NULL; memcpy (d, s, strlen (s) + 1); return d; } - diff --git a/system.c b/system.c index a0aa4dac..6384cb06 100644 --- a/system.c +++ b/system.c @@ -1,20 +1,20 @@ /* * Copyright (C) 1996-2000,2013 Michael R. Elkins - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" diff --git a/thread.c b/thread.c index 3e41b7dc..c8c76754 100644 --- a/thread.c +++ b/thread.c @@ -5,16 +5,16 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ #if HAVE_CONFIG_H # include "config.h" @@ -67,7 +67,7 @@ static int need_display_subject (CONTEXT *ctx, HEADER *hdr) break; } } - + /* if there is a parent-to-child subject change anywhere between us and our * closest displayed ancestor, display the subject */ for (tmp = tree->parent; tmp; tmp = tmp->parent) @@ -197,14 +197,14 @@ static void calculate_visibility (CONTEXT *ctx, int *max_depth) tree = tree->prev; } } - + /* now fix up for the OPTHIDETOP* options if necessary */ if (hide_top_limited || hide_top_missing) { tree = ctx->tree; FOREVER { - if (!tree->visible && tree->deep && tree->subtree_visible < 2 + if (!tree->visible && tree->deep && tree->subtree_visible < 2 && ((tree->message && hide_top_limited) || (!tree->message && hide_top_missing))) tree->deep = 0; if (!tree->deep && tree->child && tree->subtree_visible) @@ -355,7 +355,7 @@ static LIST *make_subject_list (THREAD *cur, time_t *dateptr) time_t thisdate; LIST *curlist, *oldlist, *newlist, *subjects = NULL; int rc = 0; - + FOREVER { while (!cur->message) @@ -411,14 +411,14 @@ static LIST *make_subject_list (THREAD *cur, time_t *dateptr) /* find the best possible match for a parent message based upon subject. * if there are multiple matches, the one which was sent the latest, but - * before the current message, is used. + * before the current message, is used. */ static THREAD *find_subject (CONTEXT *ctx, THREAD *cur) { struct hash_elem *ptr; THREAD *tmp, *last = NULL; LIST *subjects = NULL, *oldlist; - time_t date = 0; + time_t date = 0; subjects = make_subject_list (cur, &date); @@ -588,9 +588,9 @@ THREAD *mutt_sort_subthreads (THREAD *thread, int init) THREAD **array, *sort_key, *top, *tmp; HEADER *oldsort_key; int i, array_size, sort_top = 0; - + /* we put things into the array backwards to save some cycles, - * but we want to have to move less stuff around if we're + * but we want to have to move less stuff around if we're * resorting, so we sort backwards and then put them back * in reverse order so they're forwards */ @@ -751,14 +751,14 @@ void mutt_sort_threads (CONTEXT *ctx, int init) int i, oldsort, using_refs = 0; THREAD *thread, *new, *tmp, top; LIST *ref = NULL; - + /* set Sort to the secondary method to support the set sort_aux=reverse-* * settings. The sorting functions just look at the value of * SORT_REVERSE */ oldsort = Sort; Sort = SortAux; - + if (!ctx->thread_hash) init = 1; @@ -909,13 +909,13 @@ void mutt_sort_threads (CONTEXT *ctx, int init) ref = cur->env->references; else ref = cur->env->references->next; - + using_refs = 2; } } else ref = ref->next; /* go on with references */ - + if (!ref) break; @@ -962,7 +962,7 @@ void mutt_sort_threads (CONTEXT *ctx, int init) /* restore the oldsort order. */ Sort = oldsort; - + /* Put the list into an array. */ linearize_tree (ctx); @@ -1051,7 +1051,7 @@ int _mutt_aside_thread (HEADER *hdr, short dir, short subthreads) if ((dir != 0) ^ ((Sort & SORT_REVERSE) != 0)) { do - { + { cur = cur->next; if (!cur) return (-1); @@ -1061,7 +1061,7 @@ int _mutt_aside_thread (HEADER *hdr, short dir, short subthreads) else { do - { + { cur = cur->prev; if (!cur) return (-1); @@ -1202,7 +1202,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag) else if (flag & MUTT_THREAD_NEXT_UNREAD) return (min_unread); } - + FOREVER { cur = thread->message; @@ -1231,7 +1231,7 @@ int _mutt_traverse_thread (CONTEXT *ctx, HEADER *cur, int flag) if (cur != roothdr) cur->virtual = -1; } - else + else { if (CHECK_LIMIT) cur->virtual = cur->msgno; @@ -1314,16 +1314,16 @@ int mutt_messages_in_thread (CONTEXT *ctx, HEADER *hdr, int flag) { while (!threads[i]->message) threads[i] = threads[i]->child; - } + } if (Sort & SORT_REVERSE) rc = threads[0]->message->msgno - (threads[1] ? threads[1]->message->msgno : -1); else rc = (threads[1] ? threads[1]->message->msgno : ctx->msgcount) - threads[0]->message->msgno; - + if (flag) rc += 1; - + return (rc); } diff --git a/url.c b/url.c index 2d7c0b41..43329a49 100644 --- a/url.c +++ b/url.c @@ -1,20 +1,20 @@ /* * Copyright (C) 2000-2002,2004 Thomas Roessler - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ + */ /* * A simple URL parser. @@ -346,4 +346,3 @@ out: FREE (&tmp); return rc; } - diff --git a/url.h b/url.h index 926416e7..fc6a3189 100644 --- a/url.h +++ b/url.h @@ -26,7 +26,7 @@ typedef struct ciss_url char *host; unsigned short port; char *path; -} +} ciss_url_t; url_scheme_t url_check_scheme (const char *s); diff --git a/utf8.c b/utf8.c index 145e22b2..d1d06770 100644 --- a/utf8.c +++ b/utf8.c @@ -13,7 +13,7 @@ int mutt_wctoutf8 (char *s, unsigned int c, size_t buflen) { - if (c < (1 << 7)) + if (c < (1 << 7)) { if (s && buflen >= 1) *s++ = c;