From db62cda50055368e5f4ac51df787053f70706c30 Mon Sep 17 00:00:00 2001 From: markus schnalke Date: Wed, 14 Jan 2015 08:23:39 +0100 Subject: [PATCH] Cleanup of code layout only --- sbr/crawl_folders.c | 4 +- sbr/dtime.c | 10 +--- sbr/dtimep.lex | 140 ++++++++++++++++++++++++++------------------------ sbr/fmt_compile.c | 2 +- sbr/fmt_rfc2047.c | 12 +++-- sbr/fmt_scan.c | 9 ++-- sbr/folder_read.c | 4 +- sbr/folder_realloc.c | 4 +- sbr/getarguments.c | 2 +- sbr/m_getfld.c | 4 +- sbr/mf.c | 2 +- sbr/pidstatus.c | 6 ++- sbr/seq_list.c | 4 +- 13 files changed, 106 insertions(+), 97 deletions(-) diff --git a/sbr/crawl_folders.c b/sbr/crawl_folders.c index 0185bd8..59ec952 100644 --- a/sbr/crawl_folders.c +++ b/sbr/crawl_folders.c @@ -12,8 +12,8 @@ struct crawl_context { int max; /* - ** how many folders we currently can hold in the array - ** `folders', increased by CRAWL_NUMFOLDERS at a time + ** number of folders we can hold in the folders array; + ** increased by CRAWL_NUMFOLDERS at a time */ int total; /* how many `folders' actually has */ char **folders; /* the array of folders */ diff --git a/sbr/dtime.c b/sbr/dtime.c index 738ffd5..2f8e5dc 100644 --- a/sbr/dtime.c +++ b/sbr/dtime.c @@ -90,10 +90,7 @@ dlocaltime(time_t *clock) tw.tw_mday = tm->tm_mday; tw.tw_mon = tm->tm_mon; - /* - * tm_year is always "year - 1900". - * So we correct for this. - */ + /* tm_year is always "year - 1900". So we correct for this. */ tw.tw_year = tm->tm_year + 1900; tw.tw_wday = tm->tm_wday; tw.tw_yday = tm->tm_yday; @@ -145,10 +142,7 @@ dgmtime(time_t *clock) tw.tw_mday = tm->tm_mday; tw.tw_mon = tm->tm_mon; - /* - * tm_year is always "year - 1900" - * So we correct for this. - */ + /* tm_year is always "year - 1900". So we correct for this. */ tw.tw_year = tm->tm_year + 1900; tw.tw_wday = tm->tm_wday; tw.tw_yday = tm->tm_yday; diff --git a/sbr/dtimep.lex b/sbr/dtimep.lex index 133a9ab..83edbff 100644 --- a/sbr/dtimep.lex +++ b/sbr/dtimep.lex @@ -1,8 +1,9 @@ -/* dtimep.lex exceeds the default table capacities for some old versions - * of lex (and the minimum defaults as specified by POSIX). The following - * choices meet or exceed the lex defaults for older SunOS4.x, Solaris, - * HPUX, and AIX. - */ +/* +** dtimep.lex exceeds the default table capacities for some old versions +** of lex (and the minimum defaults as specified by POSIX). The following +** choices meet or exceed the lex defaults for older SunOS4.x, Solaris, +** HPUX, and AIX. +*/ %e4000 %p7000 %n2500 @@ -11,27 +12,30 @@ #include #include - /* Since we're looking at a string at a time, don't worry about - * wrapping to the next buffer. - */ +/* +** Since we're looking at a string at a time, don't worry about +** wrapping to the next buffer. +*/ #define yywrap() 1 #define YY_SKIP_YYWRAP #define YY_NO_INPUT - /* This is the tricky thing that makes this function cool. We - * replace the traditional int yylex(void) declaration with our - * dparsetime() declaration, essentially piggy-backing off the - * utility of the yylex() function and adding what we need to make - * the parsing function useful to us. - */ +/* +** This is the tricky thing that makes this function cool. We +** replace the traditional int yylex(void) declaration with our +** dparsetime() declaration, essentially piggy-backing off the +** utility of the yylex() function and adding what we need to make +** the parsing function useful to us. +*/ #define YY_DECL struct tws *dparsetime(char *lexstr) - /* yyerminate() is called after the input string is matched to - * completion (actually, when the lexer reaches an EOF). The only - * thing that really needs to be in this macro function is the - * return call, which must be substituted inline into dparsetime. - */ +/* +** yyerminate() is called after the input string is matched to +** completion (actually, when the lexer reaches an EOF). The only +** thing that really needs to be in this macro function is the +** return call, which must be substituted inline into dparsetime. +*/ #define yyterminate() (void)yy_delete_buffer(lexhandle); \ if(!(tw.tw_flags & TW_SUCC)) { \ @@ -44,20 +48,20 @@ return(&tw) /* - * Patchable flag that says how to interpret NN/NN/NN dates. When - * true, we do it European style: DD/MM/YY. When false, we do it - * American style: MM/DD/YY. Of course, these are all non-RFC822 - * compliant. - */ +** Patchable flag that says how to interpret NN/NN/NN dates. When +** true, we do it European style: DD/MM/YY. When false, we do it +** American style: MM/DD/YY. Of course, these are all non-RFC822 +** compliant. +*/ int europeandate = 0; /* - * Table to convert month names to numeric month. We use the - * fact that the low order 5 bits of the sum of the 2nd & 3rd - * characters of the name is a hash with no collisions for the 12 - * valid month names. (The mask to 5 bits maps any combination of - * upper and lower case into the same hash value). - */ +** Table to convert month names to numeric month. We use the +** fact that the low order 5 bits of the sum of the 2nd & 3rd +** characters of the name is a hash with no collisions for the 12 +** valid month names. (The mask to 5 bits maps any combination of +** upper and lower case into the same hash value). +*/ static int month_map[] = { 0, 6, /* 1 - Jul */ @@ -91,11 +95,12 @@ static int month_map[] = { }; /* - * Lookup table for day-of-week using the same hash trick as for above name-of- - * month table, but using the first and second character, not second and third. - * - * Compute index into table using: (day_name[0] & 7) + (day_name[1] & 4) - */ +** Lookup table for day-of-week using the same hash trick as for above +** name-of-month table, but using the first and second character, not +** second and third. +** +** Compute index into table using: (day_name[0] & 7) + (day_name[1] & 4) +*/ static int day_map[] = { 0, 0, @@ -111,15 +116,16 @@ static int day_map[] = { 3 /*11 - Wed */ }; -/* The SET* macros will parse for the appropriate field, and leave the - * cp pointer at the first character after the desired field. Be - * careful with variable-length fields or alpha-num mixes. - - * The SKIP* macros skip over characters of a particular class and - * leave cp at the position of the first character that doesn't match - * that class. Correspondingly, SKIPTO* skips until it reaches a - * character of a particular class. - */ +/* +** The SET* macros will parse for the appropriate field, and leave the +** cp pointer at the first character after the desired field. Be +** careful with variable-length fields or alpha-num mixes. +** +** The SKIP* macros skip over characters of a particular class and +** leave cp at the position of the first character that doesn't match +** that class. Correspondingly, SKIPTO* skips until it reaches a +** character of a particular class. +*/ #define INIT() { cp = yytext;} #define SETWDAY() { tw.tw_wday= day_map[(cp[0] & 7) + (cp[1] & 4)]; \ @@ -193,11 +199,11 @@ MONTH ({jan}|{feb}|{mar}|{apr}|{may}|{jun}|{jul}|{aug}|{sep}|{oct}|{nov}|{dec}) TIME ({D}:{d}{d}(:{d}{d})?) /* - * The year can either be 2 digits, or 4. However, after - * Y2K, we found that some MUA were reporting the year 100, hence - * the middle term here. yyterminate() resolves the actual - * issues with 2-digit years. - */ +** The year can either be 2 digits, or 4. However, after +** Y2K, we found that some MUA were reporting the year 100, hence +** the middle term here. yyterminate() resolves the actual +** issues with 2-digit years. +*/ YEAR (({d}{d})|(1{d}{d})|({d}{4})) @@ -209,9 +215,10 @@ nl [ \t\n()] %% %{ - /* This section begins the definition of dparsetime(). - * Put here any local variable definitions and initializations */ - + /* + ** This section begins the definition of dparsetime(). + ** Put here any local variable definitions and initializations + */ YY_BUFFER_STATE lexhandle; register unsigned char *cp; @@ -300,15 +307,15 @@ nl [ \t\n()] {D}("-"|"/"){D}("-"|"/"){YEAR}{W}{TIME} { INIT(); if(europeandate) { - /* DD/MM/YY */ - SETDAY(); - SKIPTOD(); - SETMON_NUM(); + /* DD/MM/YY */ + SETDAY(); + SKIPTOD(); + SETMON_NUM(); } else { - /* MM/DD/YY */ - SETMON_NUM(); - SKIPTOD(); - SETDAY(); + /* MM/DD/YY */ + SETMON_NUM(); + SKIPTOD(); + SETDAY(); } SKIPTOD(); SETYEAR(); @@ -372,12 +379,13 @@ nl [ \t\n()] .|\n %% -/* This is a portable way to squash a warning about the yyunput() - * function being static but never used. It costs us a tiny amount - * of extra code in the binary but the other options are: - * "%option nounput" which is flex-specific - * makefile hackery just to compile dtimep.c with different flags - */ +/* +** This is a portable way to squash a warning about the yyunput() +** function being static but never used. It costs us a tiny amount +** of extra code in the binary but the other options are: +** "%option nounput" which is flex-specific +** makefile hackery just to compile dtimep.c with different flags +*/ void dtimep_yyunput(int c) { unput(c); diff --git a/sbr/fmt_compile.c b/sbr/fmt_compile.c index 173f12d..1fc5f36 100644 --- a/sbr/fmt_compile.c +++ b/sbr/fmt_compile.c @@ -289,7 +289,7 @@ compile_error(char *str, char *cp) } advise(NULL, "\"%s\": format compile error - %s", - &usr_fstring[errpos-errctx], str); + &usr_fstring[errpos-errctx], str); adios(NULL, "%*s", errctx+1, "^"); } diff --git a/sbr/fmt_rfc2047.c b/sbr/fmt_rfc2047.c index 4e8231f..faa3cc2 100644 --- a/sbr/fmt_rfc2047.c +++ b/sbr/fmt_rfc2047.c @@ -246,14 +246,16 @@ decode_rfc2047(char *str, char *dst, size_t dstlen) while (pp < endofmime) { /* 6 + 2 bits */ while ((pp < endofmime) && - ((c1 = char64(*pp)) == -1)) { + ((c1 = char64(*pp)) + == -1)) { pp++; } if (pp < endofmime) { pp++; } while ((pp < endofmime) && - ((c2 = char64(*pp)) == -1)) { + ((c2 = char64(*pp)) + == -1)) { pp++; } if (pp < endofmime && c1 != -1 && c2 != -1) { @@ -262,7 +264,8 @@ decode_rfc2047(char *str, char *dst, size_t dstlen) } /* 4 + 4 bits */ while ((pp < endofmime) && - ((c3 = char64(*pp)) == -1)) { + ((c3 = char64(*pp)) + == -1)) { pp++; } if (pp < endofmime && c2 != -1 && c3 != -1) { @@ -271,7 +274,8 @@ decode_rfc2047(char *str, char *dst, size_t dstlen) } /* 2 + 6 bits */ while ((pp < endofmime) && - ((c4 = char64(*pp)) == -1)) { + ((c4 = char64(*pp)) + == -1)) { pp++; } if (pp < endofmime && c3 != -1 && c4 != -1) { diff --git a/sbr/fmt_scan.c b/sbr/fmt_scan.c index ec086a1..1f55a65 100644 --- a/sbr/fmt_scan.c +++ b/sbr/fmt_scan.c @@ -677,7 +677,7 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) } else str = mn->m_text; break; - } + } } } break; @@ -781,9 +781,10 @@ fmt_scan(struct format *format, char *scanl, int width, int *dat) while( (c = *sp++) && cp < ep) *cp++ = c; while (len > wid) { - /* try to break at a comma; failing that, - * break at a space. - */ + /* + ** try to break at a comma; failing that, + ** break at a space. + */ lastb = 0; sp = lp + wid; while (sp > lp && (c = *--sp) != ',') { if (! lastb && isspace(c)) diff --git a/sbr/folder_read.c b/sbr/folder_read.c index 4265763..159949a 100644 --- a/sbr/folder_read.c +++ b/sbr/folder_read.c @@ -86,9 +86,9 @@ folder_read(char *name) ** lowest we've seen? */ if (msgnum < mp->lowmsg) - mp->lowmsg = msgnum; + mp->lowmsg = msgnum; if (msgnum > mp->hghmsg) - mp->hghmsg = msgnum; + mp->hghmsg = msgnum; } /* diff --git a/sbr/folder_realloc.c b/sbr/folder_realloc.c index e69b833..8b0d67d 100644 --- a/sbr/folder_realloc.c +++ b/sbr/folder_realloc.c @@ -29,10 +29,10 @@ folder_realloc(struct msgs *mp, int lo, int hi) adios(NULL, "BUG: called folder_realloc with hi (%d) < 1", hi); if (mp->nummsg > 0 && lo > mp->lowmsg) adios(NULL, "BUG: called folder_realloc with lo (%d) > mp->lowmsg (%d)", - lo, mp->lowmsg); + lo, mp->lowmsg); if (mp->nummsg > 0 && hi < mp->hghmsg) adios(NULL, "BUG: called folder_realloc with hi (%d) < mp->hghmsg (%d)", - hi, mp->hghmsg); + hi, mp->hghmsg); /* Check if we really need to reallocate anything */ if (lo == mp->lowoff && hi == mp->hghoff) diff --git a/sbr/getarguments.c b/sbr/getarguments.c index ce33c2e..14c9a23 100644 --- a/sbr/getarguments.c +++ b/sbr/getarguments.c @@ -35,7 +35,7 @@ getarguments(char *invo_name, int argc, char **argv, int check_context) if (ap != NULL && n > 0) { while (*ap) *bp++ = *ap++; - } + } /* Copy arguments from command line */ argv++; diff --git a/sbr/m_getfld.c b/sbr/m_getfld.c index 5bd6bbb..059e0e3 100644 --- a/sbr/m_getfld.c +++ b/sbr/m_getfld.c @@ -423,8 +423,8 @@ m_getfld(int state, unsigned char *name, unsigned char *buf, *cp++ = j = *(iob->_ptr + c); c = _filbuf(iob); #endif - if (c == EOF || - ((j == '\0' || j == '\n') && c != ' ' && c != '\t')) { + if (c == EOF || ((j == '\0' || j == '\n') + && c != ' ' && c != '\t')) { if (c != EOF) { #ifdef LINUX_STDIO --iob->_IO_read_ptr; diff --git a/sbr/mf.c b/sbr/mf.c index 6338a6e..69afff8 100644 --- a/sbr/mf.c +++ b/sbr/mf.c @@ -539,7 +539,7 @@ route(char *buffer) default: sprintf(err, "no at-sign found for next domain in route (%s)", - buffer); + buffer); } break; } diff --git a/sbr/pidstatus.c b/sbr/pidstatus.c index c4e1e75..edd6749 100644 --- a/sbr/pidstatus.c +++ b/sbr/pidstatus.c @@ -52,9 +52,11 @@ pidstatus(int status, FILE *fp, char *cp) if (signum >= 0 && signum < (int)sizeof(sigmsg) && sigmsg[signum] != NULL) fprintf(fp, " (%s%s)\n", sigmsg[signum], - WCOREDUMP(status) ? ", core dumped" : ""); + WCOREDUMP(status) ? + ", core dumped" : ""); else - fprintf(fp, "%s\n", WCOREDUMP(status) ? " (core dumped)" : ""); + fprintf(fp, "%s\n", WCOREDUMP(status) ? + " (core dumped)" : ""); } } diff --git a/sbr/seq_list.c b/sbr/seq_list.c index f051e38..148ecb9 100644 --- a/sbr/seq_list.c +++ b/sbr/seq_list.c @@ -91,8 +91,8 @@ seq_list(struct msgs *mp, char *seqname) /* ** Scan to the end of this message range */ - for (++i; i <= mp->hghmsg && does_exist(mp, i) && in_sequence(mp, seqnum, i); - ++i) + for (++i; i <= mp->hghmsg && does_exist(mp, i) && + in_sequence(mp, seqnum, i); ++i) ; if (i - j > 1) { -- 1.7.10.4