From: Ralph Corderoy Date: Thu, 2 Nov 2017 01:09:32 +0000 (+0000) Subject: Move the opening brace of a C function to its own line. X-Git-Url: https://diplodocus.org/git/nmh/commitdiff_plain/dc4d0c4bf247cfc88e1f3f9463fa2264d3d226b5?ds=sidebyside;hp=a062e4ec504f324c5d5ea7907fef3a737f4d742a Move the opening brace of a C function to its own line. If the brace doesn't start a line of its own then vi(1)'s function-related commands don't spot the function. --- diff --git a/sbr/addrsbr.c b/sbr/addrsbr.c index e55c15aa..fe508ba9 100644 --- a/sbr/addrsbr.c +++ b/sbr/addrsbr.c @@ -77,7 +77,8 @@ static char adr[BUFSIZ]; static int eai = 0; void -enable_eai(void) { +enable_eai(void) +{ eai = 1; } diff --git a/sbr/base64.c b/sbr/base64.c index 2afad491..75e82301 100644 --- a/sbr/base64.c +++ b/sbr/base64.c @@ -248,7 +248,8 @@ static const unsigned char b642nib[0x80] = { */ int decodeBase64 (const char *encoded, unsigned char **decoded, size_t *len, - int skip_crs, unsigned char *digest) { + int skip_crs, unsigned char *digest) +{ const char *cp = encoded; int bitno, skip; uint32_t bits; @@ -351,7 +352,8 @@ test_end: * is allocated by the function and must be freed by the caller. */ void -hexify (const unsigned char *input, size_t len, char **output) { +hexify (const unsigned char *input, size_t len, char **output) +{ /* Start with a charstring capacity that's arbitrarily larger than len. */ const charstring_t tmp = charstring_create (2 * len); const unsigned char *cp = input; diff --git a/sbr/charstring.c b/sbr/charstring.c index 589b000e..d6243717 100644 --- a/sbr/charstring.c +++ b/sbr/charstring.c @@ -26,7 +26,8 @@ struct charstring { static void -charstring_reserve (charstring_t s, size_t need) { +charstring_reserve (charstring_t s, size_t need) +{ const size_t cur = s->cur - s->buffer; while (need >= s->max - cur) { @@ -40,7 +41,8 @@ charstring_reserve (charstring_t s, size_t need) { * max is in characters */ charstring_t -charstring_create (size_t max) { +charstring_create (size_t max) +{ charstring_t s; NEW(s); @@ -52,7 +54,8 @@ charstring_create (size_t max) { } charstring_t -charstring_copy (const charstring_t src) { +charstring_copy (const charstring_t src) +{ const size_t num = src->cur - src->buffer; charstring_t s; @@ -70,7 +73,8 @@ charstring_copy (const charstring_t src) { * OK to call charstring_free with a NULL argument. */ void -charstring_free (charstring_t s) { +charstring_free (charstring_t s) +{ if (s) { free (s->buffer); free (s); @@ -78,7 +82,8 @@ charstring_free (charstring_t s) { } void -charstring_push_back (charstring_t s, const char c) { +charstring_push_back (charstring_t s, const char c) +{ charstring_reserve (s, s->cur - s->buffer + 1); *s->cur++ = c; ++s->chars; @@ -90,7 +95,8 @@ charstring_push_back (charstring_t s, const char c) { */ void charstring_push_back_chars (charstring_t s, const char c[], size_t num, - size_t width) { + size_t width) +{ size_t i; charstring_reserve (s, s->cur - s->buffer + num); @@ -99,7 +105,8 @@ charstring_push_back_chars (charstring_t s, const char c[], size_t num, } void -charstring_append (charstring_t dest, const charstring_t src) { +charstring_append (charstring_t dest, const charstring_t src) +{ const size_t num = src->cur - src->buffer; if (num > 0) { @@ -111,7 +118,8 @@ charstring_append (charstring_t dest, const charstring_t src) { } void -charstring_append_cstring (charstring_t dest, const char src[]) { +charstring_append_cstring (charstring_t dest, const char src[]) +{ const size_t num = strlen (src); if (num > 0) { @@ -123,7 +131,8 @@ charstring_append_cstring (charstring_t dest, const char src[]) { } void -charstring_clear (charstring_t s) { +charstring_clear (charstring_t s) +{ s->cur = s->buffer; s->chars = 0; } @@ -133,7 +142,8 @@ charstring_clear (charstring_t s) { * intervening push_back's; use charstring_buffer_copy() instead. */ const char * -charstring_buffer (const charstring_t s) { +charstring_buffer (const charstring_t s) +{ charstring_reserve (s, s->cur - s->buffer + 1); /* This is the only place that we null-terminate the buffer. */ @@ -146,7 +156,8 @@ charstring_buffer (const charstring_t s) { } char * -charstring_buffer_copy (const charstring_t s) { +charstring_buffer_copy (const charstring_t s) +{ char *copy = mh_xmalloc (s->cur - s->buffer + 1); /* Use charstring_buffer() to null terminate the buffer. */ @@ -156,17 +167,20 @@ charstring_buffer_copy (const charstring_t s) { } size_t -charstring_bytes (const charstring_t s) { +charstring_bytes (const charstring_t s) +{ return s->cur - s->buffer; } size_t -charstring_chars (const charstring_t s) { +charstring_chars (const charstring_t s) +{ return s->chars; } int -charstring_last_char_len (const charstring_t s) { +charstring_last_char_len (const charstring_t s) +{ int len = 0; #ifdef MULTIBYTE_SUPPORT const char *sp = charstring_buffer (s); diff --git a/sbr/context_find.c b/sbr/context_find.c index f4fe7ed1..e312bceb 100644 --- a/sbr/context_find.c +++ b/sbr/context_find.c @@ -30,7 +30,8 @@ context_find (const char *str) */ char * context_find_by_type (const char *string, const char *type, - const char *subtype) { + const char *subtype) +{ char *value = NULL; if (subtype) { @@ -58,7 +59,8 @@ context_find_by_type (const char *string, const char *type, * The search is case insensitive. */ int -context_find_prefix (const char *prefix) { +context_find_prefix (const char *prefix) +{ struct node *np; size_t len; diff --git a/sbr/credentials.c b/sbr/credentials.c index b610b2b9..c728c52f 100644 --- a/sbr/credentials.c +++ b/sbr/credentials.c @@ -17,7 +17,8 @@ struct nmh_creds { }; void -init_credentials_file(void) { +init_credentials_file(void) +{ if (credentials_file == NULL) { char *cred_style = context_find ("credentials"); diff --git a/sbr/datetime.c b/sbr/datetime.c index a7906a52..f51ed2f4 100644 --- a/sbr/datetime.c +++ b/sbr/datetime.c @@ -59,7 +59,8 @@ struct tzdesc { */ static int parse_datetime (const char *datetime, const char *zone, bool dst, - struct tws *tws) { + struct tws *tws) +{ char utc_indicator; bool form_1; int items_matched; @@ -153,7 +154,8 @@ parse_datetime (const char *datetime, const char *zone, bool dst, } tzdesc_t -load_timezones (const contentline *clines) { +load_timezones (const contentline *clines) +{ tzdesc_t timezones = NULL, timezone = NULL; bool in_vtimezone, in_standard, in_daylight; tzparams *params = NULL; @@ -240,7 +242,8 @@ load_timezones (const contentline *clines) { } void -free_timezones (tzdesc_t timezone) { +free_timezones (tzdesc_t timezone) +{ tzdesc_t next; for ( ; timezone; timezone = next) { @@ -270,7 +273,8 @@ free_timezones (tzdesc_t timezone) { */ time_t rrule_clock (const char *rrule, const char *starttime, const char *zone, - unsigned int year) { + unsigned int year) +{ time_t clock = 0; if (nmh_strcasestr (rrule, "FREQ=YEARLY;INTERVAL=1") || @@ -333,7 +337,8 @@ fail: } char * -format_datetime (tzdesc_t timezones, const contentline *node) { +format_datetime (tzdesc_t timezones, const contentline *node) +{ param_list *p; char *dt_timezone = NULL; int dst = 0; diff --git a/sbr/escape_addresses.c b/sbr/escape_addresses.c index 05c6f936..ac314a61 100644 --- a/sbr/escape_addresses.c +++ b/sbr/escape_addresses.c @@ -12,14 +12,16 @@ static void escape_component (char *name, size_t namesize, char *chars); void -escape_display_name (char *name, size_t namesize) { +escape_display_name (char *name, size_t namesize) +{ char *specials = "\"(),.:;<>@[\\]"; escape_component (name, namesize, specials); } void -escape_local_part (char *name, size_t namesize) { +escape_local_part (char *name, size_t namesize) +{ /* wsp (whitespace) is horizontal tab or space, according to RFC 5234. */ char *specials_less_dot_plus_wsp = " \"(),:;<>@[\\]"; @@ -33,7 +35,8 @@ escape_local_part (char *name, size_t namesize) { namesize argument. The need_escape argument is a string of characters that require that name be escaped. */ static void -escape_component (char *name, size_t namesize, char *chars_to_escape) { +escape_component (char *name, size_t namesize, char *chars_to_escape) +{ /* If name contains any chars_to_escape: 1) enclose it in "" 2) escape any embedded " diff --git a/sbr/fmt_new.c b/sbr/fmt_new.c index cd81017a..05da19bc 100644 --- a/sbr/fmt_new.c +++ b/sbr/fmt_new.c @@ -56,7 +56,8 @@ new_fs (char *form, char *format, char *default_fs) void -free_fs(void) { +free_fs(void) +{ free (formats); formats = 0; } diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index 3c93a5a7..207692fc 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -67,7 +67,8 @@ match (char *str, char *sub) * copy a number to the destination subject to a maximum width */ void -cpnumber(charstring_t dest, int num, int wid, char fill, size_t max) { +cpnumber(charstring_t dest, int num, int wid, char fill, size_t max) +{ /* Maybe we should handle left padding at some point? */ if (wid == 0) return; @@ -120,7 +121,8 @@ cpnumber(charstring_t dest, int num, int wid, char fill, size_t max) { * aligned no more than max characters are copied */ void -cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) { +cptrimmed(charstring_t dest, char *str, int wid, char fill, size_t max) +{ int remaining; /* remaining output width available */ bool rjust; struct charstring *trimmed; diff --git a/sbr/icalendar.l b/sbr/icalendar.l index 3a6522ce..7e691381 100644 --- a/sbr/icalendar.l +++ b/sbr/icalendar.l @@ -289,7 +289,8 @@ folded-value {VALUE-CHAR}*({fold}{VALUE-CHAR}*)+ %% static char * -unfold (char *text, size_t *leng) { +unfold (char *text, size_t *leng) +{ /* It's legal to shorten text and modify leng (because we don't use yymore()). */ char *cp; @@ -321,7 +322,8 @@ unfold (char *text, size_t *leng) { * with something other than flex. */ static void -destroy_icallex(void) { +destroy_icallex(void) +{ #if defined FLEX_SCANNER && defined YY_FLEX_SUBMINOR_VERSION /* Hack: rely on fact that the the YY_FLEX_SUBMINOR_VERSION #define was added to flex (flex.skl v. 2.163) after @@ -335,12 +337,14 @@ destroy_icallex(void) { * because flex 2.5.4 doesn't. */ void -icalset_inputfile (FILE *file) { +icalset_inputfile (FILE *file) +{ yyin = file; } void -icalset_outputfile (FILE *file) { +icalset_outputfile (FILE *file) +{ yyout = file; } diff --git a/sbr/icalparse.y b/sbr/icalparse.y index f2fcc0ea..ef302001 100644 --- a/sbr/icalparse.y +++ b/sbr/icalparse.y @@ -138,13 +138,15 @@ param_value_list * Remove the contentline node (by setting its name to NULL). */ void -remove_contentline (contentline *node) { +remove_contentline (contentline *node) +{ free (node->name); node->name = NULL; } contentline * -add_contentline (contentline *node, const char *name) { +add_contentline (contentline *node, const char *name) +{ contentline *new_node; NEW0(new_node); @@ -159,7 +161,8 @@ add_contentline (contentline *node, const char *name) { * Remove the value from a value_list. */ void -remove_value (value_list *node) { +remove_value (value_list *node) +{ free (node->value); node->value = NULL; } @@ -170,7 +173,8 @@ remove_value (value_list *node) { */ contentline * find_contentline (contentline *contentlines, const char *name, - const char *val) { + const char *val) +{ contentline *node; for (node = contentlines; node; node = node->next) { @@ -185,7 +189,8 @@ find_contentline (contentline *contentlines, const char *name, } static char * -append (contentline *cline, const char *src, const size_t src_len) { +append (contentline *cline, const char *src, const size_t src_len) +{ if (src_len > 0) { const size_t len = cline->input_line_len + src_len; @@ -206,7 +211,8 @@ append (contentline *cline, const char *src, const size_t src_len) { } static void -new_content_line (contentline **cline) { +new_content_line (contentline **cline) +{ contentline *new_node; NEW0(new_node); @@ -223,7 +229,8 @@ new_content_line (contentline **cline) { } static void -new_vevent (vevent *event) { +new_vevent (vevent *event) +{ vevent *new_node, *node; NEW0(new_node); @@ -234,7 +241,8 @@ new_vevent (vevent *event) { } void -add_param_name (contentline *cline, char *name) { +add_param_name (contentline *cline, char *name) +{ param_list *new_node; param_list *p; @@ -254,7 +262,8 @@ add_param_name (contentline *cline, char *name) { * Add a value to the last parameter seen. */ void -add_param_value (contentline *cline, char *value) { +add_param_value (contentline *cline, char *value) +{ value_list *new_node; param_list *p; value_list *v; @@ -281,7 +290,8 @@ add_param_value (contentline *cline, char *value) { } void -free_contentlines (contentline *root) { +free_contentlines (contentline *root) +{ contentline *i, *next; for (i = root; i; i = next) { @@ -298,7 +308,8 @@ free_contentlines (contentline *root) { } static void -free_param_names (param_list *p) { +free_param_names (param_list *p) +{ param_list *next; for ( ; p; p = next) { @@ -310,7 +321,8 @@ free_param_names (param_list *p) { } static void -free_param_values (value_list *v) { +free_param_values (value_list *v) +{ value_list *next; for ( ; v; v = next) { @@ -321,7 +333,8 @@ free_param_values (value_list *v) { } static int -icalerror (const char *error) { +icalerror (const char *error) +{ contentline *c; charstring_t context = NULL; diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 2b585541..9793b054 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -331,7 +331,8 @@ m_getfld_state_t m_getfld_state_init(FILE *iob) /* scan() needs to force an initial state of FLD for each message. */ void -m_getfld_state_reset (m_getfld_state_t *gstate) { +m_getfld_state_reset (m_getfld_state_t *gstate) +{ if (*gstate) { (*gstate)->state = FLD; } @@ -341,7 +342,8 @@ m_getfld_state_reset (m_getfld_state_t *gstate) { calls, m_getfld() must keep track of the file position. The caller must use this function to inform m_getfld(). */ void -m_getfld_track_filepos (m_getfld_state_t *gstate, FILE *iob) { +m_getfld_track_filepos (m_getfld_state_t *gstate, FILE *iob) +{ if (! *gstate) { *gstate = m_getfld_state_init(iob); } @@ -358,7 +360,8 @@ void m_getfld_track_filepos2(m_getfld_state_t *gstate) m_getfld_track_filepos(gstate, (*gstate)->iob); } -void m_getfld_state_destroy (m_getfld_state_t *gstate) { +void m_getfld_state_destroy (m_getfld_state_t *gstate) +{ m_getfld_state_t s = *gstate; if (s) { @@ -401,7 +404,8 @@ void m_getfld_state_destroy (m_getfld_state_t *gstate) { static void -enter_getfld (m_getfld_state_t *gstate, FILE *iob) { +enter_getfld (m_getfld_state_t *gstate, FILE *iob) +{ m_getfld_state_t s; off_t pos; off_t pos_movement; @@ -475,7 +479,8 @@ enter_getfld (m_getfld_state_t *gstate, FILE *iob) { } static void -leave_getfld (m_getfld_state_t s) { +leave_getfld (m_getfld_state_t s) +{ s->total_bytes_read += s->bytes_read; if (s->track_filepos) { @@ -493,7 +498,8 @@ leave_getfld (m_getfld_state_t s) { } static size_t -read_more (m_getfld_state_t s) { +read_more (m_getfld_state_t s) +{ /* Retain at least edelimlen characters that have already been read, if at least edelimlen have been read, so that we can back up to them in m_Eom(). */ @@ -519,7 +525,8 @@ read_more (m_getfld_state_t s) { /* Return the next character consumed from the input, fetching more of * the input for the buffer if required, or EOF on end of file. */ static int -Getc (m_getfld_state_t s) { +Getc (m_getfld_state_t s) +{ if ((s->end - s->readpos < 1 && read_more (s) == 0) || s->readpos >= s->end) return EOF; diff --git a/sbr/m_mktemp.c b/sbr/m_mktemp.c index 123da576..726ce823 100644 --- a/sbr/m_mktemp.c +++ b/sbr/m_mktemp.c @@ -256,7 +256,8 @@ static svector_t exit_filelist = NULL; * Register a file for removal at program termination. */ static void -register_for_removal(const char *pathname) { +register_for_removal(const char *pathname) +{ if (exit_filelist == NULL) exit_filelist = svector_create(20); (void) svector_push_back(exit_filelist, mh_xstrdup(pathname)); } @@ -280,7 +281,8 @@ register_for_removal(const char *pathname) { * quickly created with the same name. */ void -unregister_for_removal(int remove_files) { +unregister_for_removal(int remove_files) +{ if (exit_filelist) { size_t i; @@ -303,7 +305,8 @@ unregister_for_removal(int remove_files) { * any case, unlink it. */ int -m_unlink(const char *pathname) { +m_unlink(const char *pathname) +{ if (exit_filelist) { char **slot = svector_find(exit_filelist, pathname); @@ -321,7 +324,8 @@ m_unlink(const char *pathname) { * Remove all registered temporary files. */ void -remove_registered_files_atexit(void) { +remove_registered_files_atexit(void) +{ unregister_for_removal(1); } @@ -333,7 +337,8 @@ remove_registered_files_atexit(void) { * in case the use was expecting a core dump. */ void -remove_registered_files(int sig) { +remove_registered_files(int sig) +{ struct sigaction act; /* diff --git a/sbr/m_rand.c b/sbr/m_rand.c index 76e5e17f..bac97507 100644 --- a/sbr/m_rand.c +++ b/sbr/m_rand.c @@ -20,7 +20,8 @@ static bool seeded = false; int -m_rand (unsigned char *buf, size_t n) { +m_rand (unsigned char *buf, size_t n) +{ #if !HAVE_ARC4RANDOM if (! seeded) { FILE *devurandom; diff --git a/sbr/message_id.c b/sbr/message_id.c index 8decfa84..ab697044 100644 --- a/sbr/message_id.c +++ b/sbr/message_id.c @@ -22,7 +22,8 @@ static char message_id_[BUFSIZ]; /* Convert name of message id style to integer value and store it. */ int -save_message_id_style (const char *value) { +save_message_id_style (const char *value) +{ if (! strcasecmp (value, "localname")) { message_id_style = NMH_MESSAGE_ID_LOCALNAME; return 0; @@ -36,7 +37,8 @@ save_message_id_style (const char *value) { char * -message_id (time_t tclock, int content_id) { +message_id (time_t tclock, int content_id) +{ switch (message_id_style) { case NMH_MESSAGE_ID_LOCALNAME: { #define P(fmt) \ diff --git a/sbr/mime_type.c b/sbr/mime_type.c index 016947aa..4e3ebbb7 100644 --- a/sbr/mime_type.c +++ b/sbr/mime_type.c @@ -20,7 +20,8 @@ static char *get_file_info(const char *, const char *); * is responsible for free'ing returned memory. */ char * -mime_type(const char *file_name) { +mime_type(const char *file_name) +{ char *content_type = NULL; /* mime content type */ char *p; diff --git a/sbr/mts.c b/sbr/mts.c index 4a056755..d67153fe 100644 --- a/sbr/mts.c +++ b/sbr/mts.c @@ -105,7 +105,8 @@ static struct bind binds[] = { /* Convert name of mts method to integer value and store it. */ void -save_mts_method (const char *value) { +save_mts_method (const char *value) +{ if (! strcasecmp (value, "smtp")) { mts_method = "smtp"; sm_mts = MTS_SMTP; diff --git a/sbr/print_help.c b/sbr/print_help.c index 2aafe06e..66d27a02 100644 --- a/sbr/print_help.c +++ b/sbr/print_help.c @@ -64,7 +64,8 @@ static const char nmh_intro3[] = \ "at http://www.nongnu.org/nmh/ .\n"; void -print_intro (FILE *file, bool brief) { +print_intro (FILE *file, bool brief) +{ fputs (nmh_intro1, file); if (! brief) { fputs (nmh_intro2, file); diff --git a/sbr/readconfig.c b/sbr/readconfig.c index 1bbc069c..0b823b93 100644 --- a/sbr/readconfig.c +++ b/sbr/readconfig.c @@ -155,7 +155,8 @@ readconfig (struct node **npp, FILE *ib, const char *file, int ctx) void -add_profile_entry (const char *key, const char *value) { +add_profile_entry (const char *key, const char *value) +{ struct node *newnode; /* This inserts the new node at the beginning of m_defs because diff --git a/sbr/signals.c b/sbr/signals.c index ad18261b..ba37ee5e 100644 --- a/sbr/signals.c +++ b/sbr/signals.c @@ -82,7 +82,8 @@ SIGNAL2 (int sig, SIGNAL_HANDLER func) * For use by nmh_init(). */ int -setup_signal_handlers(void) { +setup_signal_handlers(void) +{ /* * Catch HUP, INT, QUIT, and TERM so that we can clean up tmp * files when the user terminates the process early. And also a diff --git a/sbr/trimcpy.c b/sbr/trimcpy.c index 625c26c0..3263231a 100644 --- a/sbr/trimcpy.c +++ b/sbr/trimcpy.c @@ -49,7 +49,8 @@ trimcpy (char *cp) * complete copyright information. */ char * -cpytrim (const char *sp) { +cpytrim (const char *sp) +{ char *dp; char *cp; @@ -81,7 +82,8 @@ cpytrim (const char *sp) { * complete copyright information. */ char * -rtrim (char *sp) { +rtrim (char *sp) +{ char *cp; /* start at the end and zap trailing whitespace */ diff --git a/sbr/utils.c b/sbr/utils.c index 2d0acb39..18dd4b54 100644 --- a/sbr/utils.c +++ b/sbr/utils.c @@ -272,7 +272,8 @@ app_msgnum(struct msgnum_array *msgs, int msgnum) * pointer so that the caller can modify it. */ char * -find_str (const char buf[], size_t buflen, const char *str) { +find_str (const char buf[], size_t buflen, const char *str) +{ const size_t len = strlen (str); size_t i; @@ -291,7 +292,8 @@ find_str (const char buf[], size_t buflen, const char *str) { * pointer so that the caller can modify it. */ char * -rfind_str (const char buf[], size_t buflen, const char *str) { +rfind_str (const char buf[], size_t buflen, const char *str) +{ const size_t len = strlen (str); size_t i; @@ -305,7 +307,8 @@ rfind_str (const char buf[], size_t buflen, const char *str) { /* POSIX doesn't have strcasestr() so emulate it. */ char * -nmh_strcasestr (const char *s1, const char *s2) { +nmh_strcasestr (const char *s1, const char *s2) +{ const size_t len = strlen (s2); if (isupper ((unsigned char) s2[0]) || islower ((unsigned char)s2[0])) { @@ -500,7 +503,8 @@ int nmh_init(const char *argv0, bool read_context, bool check_version) * use that prefix here. */ int -nmh_version_changed (int older) { +nmh_version_changed (int older) +{ const char *const context_version = context_find("Version"); if (older) { @@ -559,7 +563,8 @@ bool contains8bit(const char *start, const char *end) * See if input has any 8-bit bytes. */ int -scan_input (int fd, int *eightbit) { +scan_input (int fd, int *eightbit) +{ int state; char buf[BUFSIZ]; @@ -581,7 +586,8 @@ scan_input (int fd, int *eightbit) { * Convert an int to a char string. */ char * -m_str(int value) { +m_str(int value) +{ return m_strn(value, 0); } @@ -594,7 +600,8 @@ m_str(int value) { #define SIZE(n) (sizeof STR(n)) char * -m_strn(int value, unsigned int width) { +m_strn(int value, unsigned int width) +{ /* Need to include space for negative sign. But don't use INT_MIN because it could be a macro that would fool SIZE(n). */ static char buffer[SIZE(-INT_MAX)]; diff --git a/sbr/vector.c b/sbr/vector.c index 6afe62aa..c87e2e4d 100644 --- a/sbr/vector.c +++ b/sbr/vector.c @@ -54,7 +54,8 @@ static void bvector_resize (bvector_t vec, size_t newsize); bvector_t -bvector_create (void) { +bvector_create (void) +{ bvector_t vec; /* See "wider than unsigned long" comment above. */ @@ -74,7 +75,8 @@ void bvector_init(struct bvector *bv) } void -bvector_copy (bvector_t dest, bvector_t src) { +bvector_copy (bvector_t dest, bvector_t src) +{ size_t bytes = BVEC_BYTES(src->maxsize); if (dest->bits != dest->tiny) @@ -88,7 +90,8 @@ bvector_copy (bvector_t dest, bvector_t src) { } void -bvector_free (bvector_t vec) { +bvector_free (bvector_t vec) +{ bvector_fini(vec); free (vec); } @@ -100,20 +103,23 @@ void bvector_fini(struct bvector *bv) } void -bvector_clear (bvector_t vec, size_t n) { +bvector_clear (bvector_t vec, size_t n) +{ if (n < vec->maxsize) vec->bits[BVEC_WORD(n)] &= ~(1ul << BVEC_OFFSET(n)); } void -bvector_clear_all (bvector_t vec) { +bvector_clear_all (bvector_t vec) +{ memset (vec->bits, 0, BVEC_BYTES(vec->maxsize)); } void -bvector_set (bvector_t vec, size_t n) { +bvector_set (bvector_t vec, size_t n) +{ size_t word = BVEC_WORD(n); size_t offset = BVEC_OFFSET(n); @@ -123,7 +129,8 @@ bvector_set (bvector_t vec, size_t n) { } unsigned int -bvector_at (bvector_t vec, size_t i) { +bvector_at (bvector_t vec, size_t i) +{ if (i < vec->maxsize) return !!(vec->bits[BVEC_WORD(i)] & (1ul << BVEC_OFFSET(i))); @@ -131,7 +138,8 @@ bvector_at (bvector_t vec, size_t i) { } static void -bvector_resize (bvector_t vec, size_t newsize) { +bvector_resize (bvector_t vec, size_t newsize) +{ size_t oldsize = vec->maxsize; size_t bytes; @@ -149,7 +157,8 @@ bvector_resize (bvector_t vec, size_t newsize) { } unsigned long -bvector_first_bits (bvector_t vec) { +bvector_first_bits (bvector_t vec) +{ return *vec->bits; } @@ -163,7 +172,8 @@ struct svector { static void svector_resize (svector_t, size_t); svector_t -svector_create (size_t init_size) { +svector_create (size_t init_size) +{ svector_t vec; size_t bytes; @@ -177,20 +187,23 @@ svector_create (size_t init_size) { } void -svector_free (svector_t vec) { +svector_free (svector_t vec) +{ free (vec->strs); free (vec); } char * -svector_push_back (svector_t vec, char *s) { +svector_push_back (svector_t vec, char *s) +{ if (++vec->size >= vec->maxsize) svector_resize (vec, vec->size); return vec->strs[vec->size-1] = s; } char * -svector_at (svector_t vec, size_t i) { +svector_at (svector_t vec, size_t i) +{ if (i >= vec->maxsize) svector_resize (vec, i); return vec->strs[i]; @@ -201,7 +214,8 @@ svector_at (svector_t vec, size_t i) { * The caller can replace the contents of the return address. */ char ** -svector_find (svector_t vec, const char *s) { +svector_find (svector_t vec, const char *s) +{ size_t i; char **str = vec->strs; @@ -215,17 +229,20 @@ svector_find (svector_t vec, const char *s) { } char ** -svector_strs (svector_t vec) { +svector_strs (svector_t vec) +{ return vec->strs; } size_t -svector_size (svector_t vec) { +svector_size (svector_t vec) +{ return vec->size; } static void -svector_resize (svector_t vec, size_t maxsize) { +svector_resize (svector_t vec, size_t maxsize) +{ size_t old_maxsize = vec->maxsize; while ((vec->maxsize *= 2) < maxsize) @@ -245,7 +262,8 @@ struct ivector { static void ivector_resize (ivector_t, size_t); ivector_t -ivector_create (size_t init_size) { +ivector_create (size_t init_size) +{ ivector_t vec; size_t bytes; @@ -259,34 +277,39 @@ ivector_create (size_t init_size) { } void -ivector_free (ivector_t vec) { +ivector_free (ivector_t vec) +{ free (vec->ints); free (vec); } int -ivector_push_back (ivector_t vec, int n) { +ivector_push_back (ivector_t vec, int n) +{ if (++vec->size >= vec->maxsize) ivector_resize (vec, vec->size); return vec->ints[vec->size-1] = n; } int -ivector_at (ivector_t vec, size_t i) { +ivector_at (ivector_t vec, size_t i) +{ if (i >= vec->maxsize) ivector_resize (vec, i); return vec->ints[i]; } int * -ivector_atp (ivector_t vec, size_t i) { +ivector_atp (ivector_t vec, size_t i) +{ if (i >= vec->maxsize) ivector_resize (vec, i); return &vec->ints[i]; } static void -ivector_resize (ivector_t vec, size_t maxsize) { +ivector_resize (ivector_t vec, size_t maxsize) +{ size_t old_maxsize = vec->maxsize; while ((vec->maxsize *= 2) < maxsize) diff --git a/uip/folder.c b/uip/folder.c index 97a1fdca..c8530863 100644 --- a/uip/folder.c +++ b/uip/folder.c @@ -98,7 +98,8 @@ static void readonly_folders (void); */ static void -nonexistent_folder (int status) { +nonexistent_folder (int status) +{ NMH_UNUSED (status); die("folder %s does not exist", folder); } diff --git a/uip/mhbuildsbr.c b/uip/mhbuildsbr.c index b8b28f24..9b2dc717 100644 --- a/uip/mhbuildsbr.c +++ b/uip/mhbuildsbr.c @@ -2045,7 +2045,8 @@ setup_attach_content(CT ct, char *filename) * 'attachment'. */ void -set_disposition (CT ct) { +set_disposition (CT ct) +{ if (ct->c_dispo_type == NULL) { char *cp = context_find_by_type ("disposition", ct->c_ctinfo.ci_type, ct->c_ctinfo.ci_subtype); @@ -2075,7 +2076,8 @@ set_disposition (CT ct) { * -1: ignore content and use user's locale to determine charset */ void -set_charset (CT ct, int contains8bit) { +set_charset (CT ct, int contains8bit) +{ if (ct->c_type == CT_TEXT) { struct text *t; @@ -2114,7 +2116,8 @@ set_charset (CT ct, int contains8bit) { */ void expand_pseudoheaders (CT ct, struct multipart *m, const char *infile, - const convert_list *convert_head) { + const convert_list *convert_head) +{ /* text_plain_ct is used to concatenate all of the text/plain replies into one part, instead of having each one in a separate part. */ @@ -2190,7 +2193,8 @@ expand_pseudoheaders (CT ct, struct multipart *m, const char *infile, void expand_pseudoheader (CT ct, CT *text_plain_ct, struct multipart *m, const char *infile, const char *type, - const char *argstring) { + const char *argstring) +{ char *reply_file; FILE *reply_fp = NULL; char *convert, *type_p, *subtype_p; @@ -2339,7 +2343,8 @@ expand_pseudoheader (CT ct, CT *text_plain_ct, struct multipart *m, /* Extract any Content-Type header from beginning of convert output. */ int -extract_headers (CT ct, char *reply_file, FILE **reply_fp) { +extract_headers (CT ct, char *reply_file, FILE **reply_fp) +{ char *buffer = NULL, *cp, *end_of_header; bool found_header = false; struct stat statbuf; diff --git a/uip/mhfixmsg.c b/uip/mhfixmsg.c index 25116206..1067f01b 100644 --- a/uip/mhfixmsg.c +++ b/uip/mhfixmsg.c @@ -123,7 +123,8 @@ static void pipeser (int); int -main (int argc, char **argv) { +main (int argc, char **argv) +{ int msgnum; char *cp, *file = NULL, *folder = NULL; char *maildir = NULL, buf[100], *outfile = NULL; @@ -517,7 +518,8 @@ main (int argc, char **argv) { */ static int mhfixmsgsbr (CT *ctp, char *maildir, const fix_transformations *fx, - FILE **infp, char *outfile, FILE **outfp) { + FILE **infp, char *outfile, FILE **outfp) +{ /* Store input filename in case one of the transformations, i.e., fix_boundary(), rewrites to a tmp file. */ char *input_filename = maildir @@ -624,7 +626,8 @@ mhfixmsgsbr (CT *ctp, char *maildir, const fix_transformations *fx, */ static int copy_input_to_output (const char *input_filename, FILE *infp, - const char *output_filename, FILE *outfp) { + const char *output_filename, FILE *outfp) +{ int in = fileno (infp); int out = fileno (outfp); int status = OK; @@ -643,7 +646,8 @@ copy_input_to_output (const char *input_filename, FILE *infp, * Fix mismatched outer level boundary. */ static int -fix_boundary (CT *ct, int *message_mods) { +fix_boundary (CT *ct, int *message_mods) +{ struct multipart *mp; int status = OK; @@ -719,7 +723,8 @@ fix_boundary (CT *ct, int *message_mods) { * Find boundary at end of multipart. */ static int -get_multipart_boundary (CT ct, char **part_boundary) { +get_multipart_boundary (CT ct, char **part_boundary) +{ char buffer[NMH_BUFSIZ]; char *end_boundary = NULL; off_t begin = (off_t) ct->c_end > (off_t) (ct->c_begin + sizeof buffer) @@ -806,7 +811,8 @@ get_multipart_boundary (CT ct, char **part_boundary) { * Open and copy ct->c_file to file, replacing the multipart boundary. */ static int -replace_boundary (CT ct, char *file, char *boundary) { +replace_boundary (CT ct, char *file, char *boundary) +{ FILE *fpin, *fpout; int compnum, state; char buf[NMH_BUFSIZ], name[NAMESZ]; @@ -913,7 +919,8 @@ replace_boundary (CT ct, char *file, char *boundary) { * Fix Content-Type header to reflect the content of its part. */ static int -fix_types (CT ct, svector_t fixtypes, int *message_mods) { +fix_types (CT ct, svector_t fixtypes, int *message_mods) +{ int status = OK; switch (ct->c_type) { @@ -1027,7 +1034,8 @@ fix_types (CT ct, svector_t fixtypes, int *message_mods) { * Replace a substring, allocating space to hold the new one. */ char * -replace_substring (char **str, const char *old, const char *new) { +replace_substring (char **str, const char *old, const char *new) +{ char *cp; if ((cp = strstr (*str, old))) { @@ -1056,7 +1064,8 @@ replace_substring (char **str, const char *old, const char *new) { * Remove a name=value parameter, given just its name, from a header value. */ char * -remove_parameter (char *str, const char *name) { +remove_parameter (char *str, const char *name) +{ /* It looks to me, based on the BNF in RFC 2045, than there can't be whitespace between the parameter name and the "=", or between the "=" and the parameter value. */ @@ -1105,7 +1114,8 @@ remove_parameter (char *str, const char *name) { * 8 bit. */ static int -fix_composite_cte (CT ct, int *message_mods) { +fix_composite_cte (CT ct, int *message_mods) +{ int status = OK; if (ct->c_type == CT_MESSAGE || ct->c_type == CT_MULTIPART) { @@ -1177,7 +1187,8 @@ fix_composite_cte (CT ct, int *message_mods) { * Set content encoding. */ static int -set_ce (CT ct, int encoding) { +set_ce (CT ct, int encoding) +{ const char *ce = ce_str (encoding); const struct str2init *ctinit = get_ce_method (ce); @@ -1234,7 +1245,8 @@ set_ce (CT ct, int encoding) { * Make sure each text part has a corresponding text/plain part. */ static int -ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) { +ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) +{ int status = OK; switch ((*ct)->c_type) { @@ -1395,7 +1407,8 @@ ensure_text_plain (CT *ct, CT parent, int *message_mods, int replacetextplain) { */ static int find_textplain_sibling (CT parent, int replacetextplain, - int *new_subpart_number) { + int *new_subpart_number) +{ struct multipart *mp = (struct multipart *) parent->c_ctparams; struct part *part, *prev; bool has_text_plain = false; @@ -1436,7 +1449,8 @@ find_textplain_sibling (CT parent, int replacetextplain, * Insert a new text/plain part. */ static int -insert_new_text_plain_part (CT ct, int new_subpart_number, CT parent) { +insert_new_text_plain_part (CT ct, int new_subpart_number, CT parent) +{ struct multipart *mp = (struct multipart *) parent->c_ctparams; struct part *new_part; @@ -1465,7 +1479,8 @@ insert_new_text_plain_part (CT ct, int new_subpart_number, CT parent) { * Create a text/plain part to go along with non-plain sibling part. */ static CT -build_text_plain_part (CT encoded_part) { +build_text_plain_part (CT encoded_part) +{ CT tp_part = divide_part (encoded_part); char *tmp_plain_file = NULL; @@ -1503,7 +1518,8 @@ build_text_plain_part (CT encoded_part) { * Slip new text/plain part into a new multipart/alternative. */ static int -insert_into_new_mp_alt (CT *ct, int *message_mods) { +insert_into_new_mp_alt (CT *ct, int *message_mods) +{ CT tp_part = build_text_plain_part (*ct); int status = OK; @@ -1543,7 +1559,8 @@ insert_into_new_mp_alt (CT *ct, int *message_mods) { * Clone a MIME part. */ static CT -divide_part (CT ct) { +divide_part (CT ct) +{ CT new_part; NEW0(new_part); @@ -1573,7 +1590,8 @@ divide_part (CT ct) { * Copy the content info from one part to another. */ static void -copy_ctinfo (CI dest, CI src) { +copy_ctinfo (CI dest, CI src) +{ PM s_pm, d_pm; dest->ci_type = src->ci_type ? mh_xstrdup (src->ci_type) : NULL; @@ -1599,7 +1617,8 @@ copy_ctinfo (CI dest, CI src) { * Decode content. */ static int -decode_part (CT ct) { +decode_part (CT ct) +{ char *tmp_decoded; int status; FILE *file; @@ -1629,7 +1648,8 @@ decode_part (CT ct) { * be in the future for other than text types. */ static int -reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) { +reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) +{ int output_subtype, output_encoding; const char *reason = NULL; char *cp, *cf; @@ -1695,7 +1715,8 @@ reformat_part (CT ct, char *file, char *type, char *subtype, int c_type) { * Fill in a multipart/alternative part. */ static CT -build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) { +build_multipart_alt (CT first_alt, CT new_part, int type, int subtype) +{ char *boundary_prefix = "----=_nmh-multipart"; char *boundary = concat (boundary_prefix, first_alt->c_partno, NULL); char *boundary_indicator = "; boundary="; @@ -1831,7 +1852,8 @@ return_null: * Check that the boundary does not appear in the content. */ static int -boundary_in_content (FILE **fp, char *file, const char *boundary) { +boundary_in_content (FILE **fp, char *file, const char *boundary) +{ char buffer[NMH_BUFSIZ]; size_t bytes_read; bool found_boundary = false; @@ -1858,7 +1880,8 @@ boundary_in_content (FILE **fp, char *file, const char *boundary) { * Remove all non-Content headers. */ static void -transfer_noncontent_headers (CT old, CT new) { +transfer_noncontent_headers (CT old, CT new) +{ HF hp, hp_prev; hp_prev = hp = old->c_first_hf; @@ -1902,7 +1925,8 @@ transfer_noncontent_headers (CT old, CT new) { * Set content type. */ static int -set_ct_type (CT ct, int type, int subtype, int encoding) { +set_ct_type (CT ct, int type, int subtype, int encoding) +{ char *typename = ct_type_str (type); char *subtypename = ct_subtype_str (type, subtype); /* E.g, " text/plain" */ @@ -1963,7 +1987,8 @@ set_ct_type (CT ct, int type, int subtype, int encoding) { */ static int decode_text_parts (CT ct, int encoding, const char *decodetypes, - int *message_mods) { + int *message_mods) +{ int status = OK; int lf_line_endings = 0; @@ -2083,7 +2108,8 @@ decode_text_parts (CT ct, int encoding, const char *decodetypes, * decodetypes (which came from the -decodetypes switch). */ static int -should_decode(const char *decodetypes, const char *type, const char *subtype) { +should_decode(const char *decodetypes, const char *type, const char *subtype) +{ /* Quick search for matching type[/subtype] in decodetypes: bracket decodetypes with commas, then search for ,type, and ,type/subtype, in it. */ @@ -2118,7 +2144,8 @@ should_decode(const char *decodetypes, const char *type, const char *subtype) { * to a string explaining why. */ static int -content_encoding (CT ct, const char **reason) { +content_encoding (CT ct, const char **reason) +{ CE ce = &ct->c_cefile; int encoding = CE_7BIT; @@ -2177,7 +2204,8 @@ content_encoding (CT ct, const char **reason) { * Strip carriage returns from content. */ static int -strip_crs (CT ct, int *message_mods) { +strip_crs (CT ct, int *message_mods) +{ char *charset = content_charset (ct); int status = OK; @@ -2331,7 +2359,8 @@ strip_crs (CT ct, int *message_mods) { * of the part C-T-E's. */ static void -update_cte (CT ct) { +update_cte (CT ct) +{ const int least_restrictive_enc = least_restrictive_encoding (ct); if (least_restrictive_enc != CE_UNKNOWN && @@ -2360,7 +2389,8 @@ update_cte (CT ct) { * within a message. */ static int -least_restrictive_encoding (CT ct) { +least_restrictive_encoding (CT ct) +{ int encoding = CE_UNKNOWN; switch (ct->c_type) { @@ -2408,7 +2438,8 @@ least_restrictive_encoding (CT ct) { * CE_8BIT is less restrictive than CE_7BIT. */ static int -less_restrictive (int encoding, int second_encoding) { +less_restrictive (int encoding, int second_encoding) +{ switch (second_encoding) { case CE_BINARY: return encoding != CE_BINARY; @@ -2427,7 +2458,8 @@ less_restrictive (int encoding, int second_encoding) { * Convert character set of each part. */ static int -convert_charsets (CT ct, char *dest_charset, int *message_mods) { +convert_charsets (CT ct, char *dest_charset, int *message_mods) +{ int status = OK; switch (ct->c_type) { @@ -2492,7 +2524,8 @@ convert_charsets (CT ct, char *dest_charset, int *message_mods) { * headers, respectively. */ static int -fix_always (CT ct, int *message_mods) { +fix_always (CT ct, int *message_mods) +{ int status = OK; switch (ct->c_type) { @@ -2574,7 +2607,8 @@ fix_always (CT ct, int *message_mods) { * Factor out common code for loops in fix_filename_encoding(). */ static int -fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) { +fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) +{ bool fixed = false; if (has_prefix(value, "=?") && has_suffix(value, "?=")) { @@ -2600,7 +2634,8 @@ fix_filename_param (char *name, char *value, PM *first_pm, PM *last_pm) { * headers, respectively. */ static int -fix_filename_encoding (CT ct) { +fix_filename_encoding (CT ct) +{ PM pm; HF hf; int fixed = 0; @@ -2666,7 +2701,8 @@ fix_filename_encoding (CT ct) { */ static int write_content (CT ct, const char *input_filename, char *outfile, FILE *outfp, - int modify_inplace, int message_mods) { + int modify_inplace, int message_mods) +{ int status = OK; if (modify_inplace) { @@ -2743,7 +2779,8 @@ write_content (CT ct, const char *input_filename, char *outfile, FILE *outfp, * function to do it. It touches the parts the decodetypes identifies. */ static void -set_text_ctparams(CT ct, char *decodetypes, int lf_line_endings) { +set_text_ctparams(CT ct, char *decodetypes, int lf_line_endings) +{ switch (ct->c_type) { case CT_MULTIPART: { struct multipart *m = (struct multipart *) ct->c_ctparams; @@ -2779,7 +2816,8 @@ set_text_ctparams(CT ct, char *decodetypes, int lf_line_endings) { * use the standard MH backup file. */ static int -remove_file (const char *file) { +remove_file (const char *file) +{ if (rmmproc) { char *rmm_command = concat (rmmproc, " ", file, NULL); int status = system (rmm_command); @@ -2798,7 +2836,8 @@ remove_file (const char *file) { * Output formatted message to user. */ static void -report (char *what, char *partno, char *filename, char *message, ...) { +report (char *what, char *partno, char *filename, char *message, ...) +{ va_list args; char *fmt; diff --git a/uip/mhical.c b/uip/mhical.c index a25b08bf..561935bf 100644 --- a/uip/mhical.c +++ b/uip/mhical.c @@ -60,7 +60,8 @@ vevent vevents = { NULL, NULL, NULL}; int parser_status = 0; int -main (int argc, char *argv[]) { +main (int argc, char *argv[]) +{ /* RFC 5322 § 3.3 date-time format, including the optional day-of-week and not including the optional seconds. The zone is required by the RFC but not always output by this @@ -257,7 +258,8 @@ main (int argc, char *argv[]) { * - Excise VALARM sections. */ static void -convert_to_reply (contentline *clines, act action) { +convert_to_reply (contentline *clines, act action) +{ char *partstat = NULL; bool found_my_attendee_line = false; contentline *node; @@ -363,7 +365,8 @@ convert_to_reply (contentline *clines, act action) { * - Excise VALARM sections. */ static void -convert_to_cancellation (contentline *clines) { +convert_to_cancellation (contentline *clines) +{ contentline *node; convert_common (clines, ACT_CANCEL); @@ -385,7 +388,8 @@ convert_to_cancellation (contentline *clines) { } static void -convert_common (contentline *clines, act action) { +convert_common (contentline *clines, act action) +{ contentline *node; bool in_valarm; @@ -496,7 +500,8 @@ convert_common (contentline *clines, act action) { /* Echo the input, but with unfolded lines. */ static void -dump_unfolded (FILE *file, contentline *clines) { +dump_unfolded (FILE *file, contentline *clines) +{ contentline *node; for (node = clines; node; node = node->next) { @@ -505,7 +510,8 @@ dump_unfolded (FILE *file, contentline *clines) { } static void -output (FILE *file, contentline *clines, int contenttype) { +output (FILE *file, contentline *clines, int contenttype) +{ contentline *node; if (contenttype) { @@ -558,7 +564,8 @@ output (FILE *file, contentline *clines, int contenttype) { * - attendees (limited to number specified in initialization) */ static void -display (FILE *file, contentline *clines, char *nfs) { +display (FILE *file, contentline *clines, char *nfs) +{ tzdesc_t timezones = load_timezones (clines); bool in_vtimezone; bool in_valarm; @@ -727,7 +734,8 @@ display (FILE *file, contentline *clines, char *nfs) { } static const char * -identity (const contentline *node) { +identity (const contentline *node) +{ /* According to RFC 5545 § 3.3.3, an email address in the value must be a mailto URI. */ if (! strncasecmp (node->value, "mailto:", 7)) { @@ -757,7 +765,8 @@ identity (const contentline *node) { } static char * -format_params (char *line, param_list *p) { +format_params (char *line, param_list *p) +{ for ( ; p && p->param_name; p = p->next) { value_list *v; size_t num_values = 0; @@ -790,7 +799,8 @@ format_params (char *line, param_list *p) { } static char * -fold (char *line, int uses_cr) { +fold (char *line, int uses_cr) +{ size_t remaining = strlen (line); size_t current_line_len = 0; charstring_t folded_line = charstring_create (2 * remaining); diff --git a/uip/mhparse.c b/uip/mhparse.c index 4a5f8055..4efe1a31 100644 --- a/uip/mhparse.c +++ b/uip/mhparse.c @@ -1377,7 +1377,8 @@ prefer_parts(CT ct) example, a text/plain part before a text/html part in a multipart/alternative part, for example, where it belongs. */ void -reverse_alternative_parts (CT ct) { +reverse_alternative_parts (CT ct) +{ if (ct->c_type == CT_MULTIPART) { struct multipart *m = (struct multipart *) ct->c_ctparams; struct part *part; @@ -3046,7 +3047,8 @@ get_leftover_mp_content (CT ct, int before /* or after */) char * -ct_type_str (int type) { +ct_type_str (int type) +{ switch (type) { case CT_APPLICATION: return "application"; @@ -3071,7 +3073,8 @@ ct_type_str (int type) { char * -ct_subtype_str (int type, int subtype) { +ct_subtype_str (int type, int subtype) +{ switch (type) { case CT_APPLICATION: switch (subtype) { @@ -3126,7 +3129,8 @@ ct_subtype_str (int type, int subtype) { int -ct_str_type (const char *type) { +ct_str_type (const char *type) +{ struct str2init *s2i; for (s2i = str2cts; s2i->si_key; ++s2i) { @@ -3143,7 +3147,8 @@ ct_str_type (const char *type) { int -ct_str_subtype (int type, const char *subtype) { +ct_str_subtype (int type, const char *subtype) +{ struct k2v *kv; switch (type) { @@ -3183,7 +3188,8 @@ ct_str_subtype (int type, const char *subtype) { /* Find the content type and InitFunc for the CT. */ const struct str2init * -get_ct_init (int type) { +get_ct_init (int type) +{ const struct str2init *sp; for (sp = str2cts; sp->si_key; ++sp) { @@ -3196,7 +3202,8 @@ get_ct_init (int type) { } const char * -ce_str (int encoding) { +ce_str (int encoding) +{ switch (encoding) { case CE_BASE64: return "base64"; @@ -3219,7 +3226,8 @@ ce_str (int encoding) { /* Find the content type and InitFunc for the content encoding method. */ const struct str2init * -get_ce_method (const char *method) { +get_ce_method (const char *method) +{ struct str2init *sp; for (sp = str2ces; sp->si_key; ++sp) { @@ -3641,7 +3649,8 @@ bad_quote: */ char * -content_charset (CT ct) { +content_charset (CT ct) +{ char *ret_charset = NULL; ret_charset = get_param(ct->c_ctinfo.ci_first_pm, "charset", '?', 0); diff --git a/uip/mhshowsbr.c b/uip/mhshowsbr.c index bbad9f08..2a754a41 100644 --- a/uip/mhshowsbr.c +++ b/uip/mhshowsbr.c @@ -791,7 +791,8 @@ show_external (CT ct, int alternate, int concatsw, int textonly, int inlineonly, static int parse_display_string (CT ct, char *cp, int *xstdin, int *xlist, char *file, char *buffer, size_t buflen, - int multipart) { + int multipart) +{ int len; bool quoted = false; char *bp = buffer, *pp; @@ -1056,7 +1057,8 @@ raw: int -convert_charset (CT ct, char *dest_charset, int *message_mods) { +convert_charset (CT ct, char *dest_charset, int *message_mods) +{ char *src_charset = content_charset (ct); int status = OK; @@ -1252,7 +1254,8 @@ iconv_start: static int -convert_content_charset (CT ct, char **file) { +convert_content_charset (CT ct, char **file) +{ int status = OK; #ifdef HAVE_ICONV diff --git a/uip/mhstoresbr.c b/uip/mhstoresbr.c index 2b944843..6bf97900 100644 --- a/uip/mhstoresbr.c +++ b/uip/mhstoresbr.c @@ -46,7 +46,8 @@ struct mhstoreinfo { static bool use_param_as_filename(const char *p); mhstoreinfo_t -mhstoreinfo_create (CT *ct, char *pwd, const char *csw, int asw, int vsw) { +mhstoreinfo_create (CT *ct, char *pwd, const char *csw, int asw, int vsw) +{ mhstoreinfo_t info; NEW(info); @@ -62,14 +63,16 @@ mhstoreinfo_create (CT *ct, char *pwd, const char *csw, int asw, int vsw) { } void -mhstoreinfo_free (mhstoreinfo_t info) { +mhstoreinfo_free (mhstoreinfo_t info) +{ free (info->cwd); free (info->dir); free (info); } int -mhstoreinfo_files_not_clobbered (const mhstoreinfo_t info) { +mhstoreinfo_files_not_clobbered (const mhstoreinfo_t info) +{ return info->files_not_clobbered; } @@ -1126,7 +1129,8 @@ copy_some_headers (FILE *out, CT ct) static enum clobber_policy_t -clobber_policy (const char *value) { +clobber_policy (const char *value) +{ if (value == NULL || ! strcasecmp (value, "always")) { return NMH_CLOBBER_ALWAYS; } @@ -1148,7 +1152,8 @@ clobber_policy (const char *value) { static char * -next_version (char *file, enum clobber_policy_t clobber_policy) { +next_version (char *file, enum clobber_policy_t clobber_policy) +{ const size_t max_versions = 1000000; /* 8 = log max_versions + one for - or . + one for null terminator */ const size_t buflen = strlen (file) + 8; @@ -1209,7 +1214,8 @@ next_version (char *file, enum clobber_policy_t clobber_policy) { static char * -clobber_check (char *original_file, mhstoreinfo_t info) { +clobber_check (char *original_file, mhstoreinfo_t info) +{ /* clobber policy return value * -------------- ------------ * -always original_file diff --git a/uip/mkstemp.c b/uip/mkstemp.c index f066c536..906d21ea 100644 --- a/uip/mkstemp.c +++ b/uip/mkstemp.c @@ -34,7 +34,8 @@ static void process_args(int, char **, const char **, const char **, const char */ int -main(int argc, char *argv[]) { +main(int argc, char *argv[]) +{ const char *directory = "", *prefix = "", *suffix = ""; size_t suffix_len; int fd; @@ -67,7 +68,8 @@ main(int argc, char *argv[]) { static char * -build_template(const char *directory, const char *prefix, const char *suffix) { +build_template(const char *directory, const char *prefix, const char *suffix) +{ const char pattern[] = "XXXXXX"; size_t len, directory_len, pathsep_len, prefix_len, suffix_len; char *template; @@ -146,7 +148,8 @@ DEFINE_SWITCH_ARRAY(MHFIXMSG, switches); static void process_args(int argc, char **argv, const char **directory, - const char **prefix, const char **suffix) { + const char **prefix, const char **suffix) +{ char **argp, **arguments, *cp, buf[100]; # if ! HAVE_MKSTEMPS NMH_UNUSED(suffix); @@ -210,7 +213,8 @@ process_args(int argc, char **argv, const char **directory, #else /* ! NMH */ static void process_args(int argc, char **argv, const char **directory, - const char **prefix, const char **suffix) { + const char **prefix, const char **suffix) +{ # if HAVE_MKSTEMPS const char usage[] = "usage: %s [-h] [-d directory] [-p prefix] [-s suffix]\n"; diff --git a/uip/repl.c b/uip/repl.c index 71ea4818..ffb54844 100644 --- a/uip/repl.c +++ b/uip/repl.c @@ -510,7 +510,8 @@ docc (char *cp, int ccflag) */ static void add_convert_header (const char *convert_type, char *convert_arg, - char *filename, char *drft) { + char *filename, char *drft) +{ char *field_name; field_name = concat (MHBUILD_FILE_PSEUDOHEADER, convert_type, NULL); diff --git a/uip/replsbr.c b/uip/replsbr.c index 4a453925..3fa67d20 100644 --- a/uip/replsbr.c +++ b/uip/replsbr.c @@ -486,7 +486,8 @@ replfilter (FILE *in, FILE *out, char *filter, int fmtproc) static char * -fix_addresses (char *str) { +fix_addresses (char *str) +{ char *fixed_str = NULL; bool fixed_address = false; diff --git a/uip/scansbr.c b/uip/scansbr.c index 11646981..a4508c02 100644 --- a/uip/scansbr.c +++ b/uip/scansbr.c @@ -354,11 +354,13 @@ finished: /* The following two functions allow access to the global gstate above. */ void -scan_finished(void) { +scan_finished(void) +{ m_getfld_state_destroy (&gstate); } void -scan_detect_mbox_style (FILE *f) { +scan_detect_mbox_style (FILE *f) +{ m_unknown (&gstate, f); } diff --git a/uip/sendsbr.c b/uip/sendsbr.c index 8d6dd616..5a841b0a 100644 --- a/uip/sendsbr.c +++ b/uip/sendsbr.c @@ -740,7 +740,8 @@ oops: static void -handle_sendfrom(char **vec, int *vecp, char *draft, const char *auth_svc) { +handle_sendfrom(char **vec, int *vecp, char *draft, const char *auth_svc) +{ const char *addr, *host; const char *message; @@ -783,7 +784,8 @@ handle_sendfrom(char **vec, int *vecp, char *draft, const char *auth_svc) { */ static int setup_oauth_params(char *vec[], int *vecp, const char *auth_svc, - const char **message) { + const char **message) +{ const char *saslmech = NULL, *user = NULL; mh_oauth_service_info svc; char errbuf[256]; @@ -848,7 +850,8 @@ setup_oauth_params(char *vec[], int *vecp, const char *auth_svc, */ static int -get_from_header_info(const char *filename, const char **addr, const char **host, const char **message) { +get_from_header_info(const char *filename, const char **addr, const char **host, const char **message) +{ struct stat st; FILE *in; @@ -902,7 +905,8 @@ get_from_header_info(const char *filename, const char **addr, const char **host, */ static const char * -get_message_header_info(FILE *in, char *format) { +get_message_header_info(FILE *in, char *format) +{ int dat[5]; struct format *fmt; struct stat st; @@ -980,7 +984,8 @@ get_message_header_info(FILE *in, char *format) { */ static void -merge_profile_entry(const char *addr, const char *host, char *vec[], int *vecp) { +merge_profile_entry(const char *addr, const char *host, char *vec[], int *vecp) +{ char *addr_entry = concat("sendfrom-", addr, NULL); char *profile_entry = context_find(addr_entry);