From: Jaakko Heinonen Date: Fri, 29 Jul 2005 11:06:35 +0000 (+0000) Subject: - remove trailing whitespaces X-Git-Tag: upstream/0.6.1~2^2~192 X-Git-Url: https://git.deb.at/w?a=commitdiff_plain;h=ef379a20d142cb95ba08c7887c8e3245269b3fdd;p=pkg%2Fabook.git - remove trailing whitespaces --- diff --git a/abook.c b/abook.c index 24d9f52..4c9df4f 100644 --- a/abook.c +++ b/abook.c @@ -189,7 +189,7 @@ main(int argc, char **argv) init_abook(); - get_commands(); + get_commands(); quit_abook(QUIT_SAVE); @@ -394,7 +394,7 @@ show_usage() { puts (PACKAGE " v " VERSION "\n"); puts (" -h --help show usage"); - puts (" -C --config use an alternative configuration file"); + puts (" -C --config use an alternative configuration file"); puts (" --datafile use an alternative addressbook file"); puts (" --mutt-query make a query for mutt"); puts (" --add-email " @@ -592,12 +592,12 @@ launch_wwwbrowser(int item) FILE * abook_fopen (const char *path, const char *mode) -{ +{ struct stat s; bool stat_ok; stat_ok = (stat(path, &s) != -1); - + if(strchr(mode, 'r')) return (stat_ok && S_ISREG(s.st_mode)) ? fopen(path, mode) : NULL; @@ -722,7 +722,7 @@ add_email_add_item(int quiet, char *name, char *email) return 0; } } - + if(!quiet) { FILE *in = fopen("/dev/tty", "r"); char c; diff --git a/abook.h b/abook.h index b5e7c76..1c1e29d 100644 --- a/abook.h +++ b/abook.h @@ -17,8 +17,8 @@ int strncasecmp (const char *, const char *, size_t); #define Y_STATUSLINE (LINES - 2) -#define MIN_LINES 20 -#define MIN_COLS 70 +#define MIN_LINES 20 +#define MIN_COLS 70 #define DEFAULT_UMASK 066 #define DIR_IN_HOME ".abook" diff --git a/database.c b/database.c index 5da2e93..f7bb745 100644 --- a/database.c +++ b/database.c @@ -60,7 +60,7 @@ struct abook_field abook_fields[ITEM_FIELDS] = { {"Name", "name", TAB_CONTACT},/* NAME */ {"E-mails", "email", TAB_CONTACT},/* EMAIL */ {"Address", "address", TAB_ADDRESS},/* ADDRESS */ - {"Address2", "address2", TAB_ADDRESS},/* ADDRESS2 */ + {"Address2", "address2", TAB_ADDRESS},/* ADDRESS2 */ {"City", "city", TAB_ADDRESS},/* CITY */ {"State/Province","state", TAB_ADDRESS},/* STATE */ {"ZIP/Postal Code","zip", TAB_ADDRESS},/* ZIP */ @@ -101,7 +101,7 @@ parse_database(FILE *in) list_item item; memset(&item, 0, sizeof(item)); - + for(;;) { line = getaline(in); if( feof(in) ) { @@ -140,7 +140,7 @@ next: return 0; } - + int load_database(char *filename) @@ -152,7 +152,7 @@ load_database(char *filename) if ( (in = abook_fopen(filename, "r")) == NULL ) return -1; - + parse_database(in); return (items == 0) ? 2 : 0; @@ -204,11 +204,11 @@ save_database() return 1; } - + write_database(out, e); - + fclose(out); - + return 0; } @@ -231,7 +231,7 @@ void close_database() { int i; - + for(i=0; i < items; i++) free_item(i); @@ -253,7 +253,7 @@ validate_item(list_item item) { int i; char *tmp; - + if(item[EMAIL] == NULL) item[EMAIL] = strdup(""); @@ -312,7 +312,7 @@ remove_selected_items() if( ! selected_items() ) selected[ curitem ] = 1; - + for( j = LAST_ITEM; j >= 0; j-- ) { if( selected[j] ) { free_item(j); /* added for .4 data_s_ */ @@ -320,7 +320,7 @@ remove_selected_items() itemcpy(database[ i ], database[ i + 1 ]); selected[ i ] = selected[ i + 1 ]; } - items--; + items--; } } @@ -379,7 +379,7 @@ namecmp(const void *i1, const void *i2) itemcpy(a, i1); itemcpy(b, i2); - + return safe_strcoll( a[sort_field], b[sort_field] ); } @@ -415,7 +415,7 @@ sort_by_field(int field) } sort_field = field; - + qsort((void *)database, items, sizeof(list_item), namecmp); refresh_screen(); @@ -482,7 +482,7 @@ real_db_enumerate_items(struct db_enumerator e) { int item = max(0, e.item + 1); int i; - + switch(e.mode) { #ifdef DEBUG case ENUM_ALL: @@ -533,7 +533,7 @@ assign_fieldname(const char *name, int i) */ if(strcasecmp(abook_fields[i].name, abook_fields[i].key)) xfree(abook_fields[i].name); - + s = xmalloc_inc(MAX_FIELDNAME_LEN, 1); snprintf(s, MAX_FIELDNAME_LEN, "%s", name); abook_fields[i].name = s; diff --git a/edit.c b/edit.c index cb42326..a32121e 100644 --- a/edit.c +++ b/edit.c @@ -98,7 +98,7 @@ roll_emails(int item) strcpy(database[item][EMAIL], p+1); strcat(database[item][EMAIL], ","); - strcat(database[item][EMAIL], tmp); + strcat(database[item][EMAIL], tmp); } static void diff --git a/edit.h b/edit.h index 54310d7..5a8db07 100644 --- a/edit.h +++ b/edit.h @@ -29,7 +29,7 @@ enum { }; #define MAX_TAB TAB_CUSTOM - + #define TABS (MAX_TAB+1) #endif diff --git a/filter.c b/filter.c index f5998ba..9eb9619 100644 --- a/filter.c +++ b/filter.c @@ -97,14 +97,14 @@ void print_filters() { int i; - + puts("input:"); for(i=0; *i_filters[i].filtname ; i++) printf("\t%s\t%s\n", i_filters[i].filtname, i_filters[i].desc); putchar('\n'); - + puts("output:"); for(i=0; *e_filters[i].filtname ; i++) printf("\t%s\t%s\n", e_filters[i].filtname, @@ -159,21 +159,21 @@ get_real_name() /* * import */ - + static int i_read_file(char *filename, int (*func) (FILE *in)); static void import_screen() { int i; - + clear(); refresh_statusline(); headerline("import database"); mvaddstr(3, 1, "please select a filter"); - + for(i=0; *i_filters[i].filtname ; i++) mvprintw(5 + i, 6, "%c -\t%s\t%s\n", 'a' + i, @@ -191,27 +191,27 @@ import_database() int tmp = items; import_screen(); - + filter = getch() - 'a'; if(filter == 'x' - 'a' || filter >= number_of_input_filters() || filter < 0) { refresh_screen(); return 1; } - + mvaddstr(5+filter, 2, "->"); - + filename = ask_filename("Filename: "); if( !filename ) { refresh_screen(); return 2; } - + if( i_read_file(filename, i_filters[filter].func ) ) statusline_msg("Error occured while opening the file"); else if( tmp == items ) statusline_msg("Hmm.., file seems not to be a valid file"); - + refresh_screen(); free(filename); @@ -233,7 +233,7 @@ i_read_file(char *filename, int (*func) (FILE *in)) fclose(in); - return ret; + return ret; } int @@ -264,10 +264,10 @@ import_file(char filtname[FILTNAME_LEN], char *filename) ret = (*i_filters[i].func) (stdin); } else ret = i_read_file(filename, i_filters[i].func); - + if( tmp == items ) ret = 1; - + return ret; } @@ -282,7 +282,7 @@ static void export_screen() { int i; - + clear(); @@ -290,7 +290,7 @@ export_screen() headerline("export database"); mvaddstr(3, 1, "please select a filter"); - + for(i=0; *e_filters[i].filtname ; i++) mvprintw(5 + i, 6, "%c -\t%s\t%s\n", 'a' + i, @@ -308,14 +308,14 @@ export_database() char *filename; export_screen(); - + filter = getch() - 'a'; if(filter == 'x' - 'a' || filter >= number_of_output_filters() || filter < 0) { refresh_screen(); return 1; } - + mvaddstr(5+filter, 2, "->"); if( selected_items() ) { @@ -330,16 +330,16 @@ export_database() } clear_statusline(); } - + filename = ask_filename("Filename: "); if( !filename ) { refresh_screen(); return 2; } - + if( e_write_file(filename, e_filters[filter].func, enum_mode ) ) statusline_msg("Error occured while exporting"); - + refresh_screen(); free(filename); @@ -361,9 +361,9 @@ e_write_file(char *filename, int (*func) (FILE *in, struct db_enumerator e), return 1; ret = (*func) (out, enumerator); - + fclose(out); - + return ret; } @@ -395,7 +395,7 @@ export_file(char filtname[FILTNAME_LEN], char *filename) int i; int ret = 0; struct db_enumerator e = init_db_enumerator(mode); - + for(i=0;; i++) { if( ! strncasecmp(e_filters[i].filtname, filtname, FILTNAME_LEN) ) @@ -434,7 +434,7 @@ static void ldif_fix_string(char *str); typedef char* ldif_item[LDIF_ITEM_FIELDS]; static ldif_item ldif_field_names = { - "cn", + "cn", "mail", "streetaddress", "streetaddress2", @@ -456,7 +456,7 @@ static int ldif_conv_table[LDIF_ITEM_FIELDS] = { NAME, /* "cn" */ EMAIL, /* "mail" */ ADDRESS, /* "streetaddress" */ - ADDRESS2, /* "streetaddress2" */ + ADDRESS2, /* "streetaddress2" */ CITY, /* "locality" */ STATE, /* "st" */ ZIP, /* "postalcode" */ @@ -472,7 +472,7 @@ static int ldif_conv_table[LDIF_ITEM_FIELDS] = { }; -static char * +static char * ldif_read_line(FILE *in) { char *buf = NULL; @@ -485,10 +485,10 @@ ldif_read_line(FILE *in) pos = ftell(in); line = getaline(in); - + if( feof(in) || !line ) break; - + if(i == 1) { buf = line; continue; @@ -656,7 +656,7 @@ mutt_read_line(FILE *in, char **alias, char **rest) while(ISSPACE(*ptr)) ptr++; - *rest = strdup(ptr); + *rest = strdup(ptr); free(line); return 0; @@ -880,7 +880,7 @@ html_export_write_tail(FILE *out) fprintf(out, "\n\n"); fprintf(out, "\n\n\n"); } - + /* * end of html export filter */ @@ -919,7 +919,7 @@ pine_convert_emails(char *s) for(i=1; ( tmp = strchr(s, ',') ) != NULL ; i++, s=tmp+1 ) if( i > MAX_EMAILS - 1 ) { *tmp = 0; - break; + break; } } @@ -935,7 +935,7 @@ pine_parse_buf(char *buf) int pine_conv_table[]= {NICK, NAME, EMAIL, -1, NOTES}; memset(&item, 0, sizeof(item)); - + for(i=0, last=0; !last ; i++) { if( ! (end = strchr(start, '\t')) ) last=1; @@ -968,7 +968,7 @@ pine_parse_file(FILE *in) char *ptr; int i; - fgets(line, LINESIZE, in); + fgets(line, LINESIZE, in); while(!feof(in)) { for(i = 2;;i++) { @@ -1038,9 +1038,9 @@ pine_export_database(FILE *out, struct db_enumerator e) /* FIXME * these files should be parsed according to a certain - * lay out, or the default if layout is not given, at + * lay out, or the default if layout is not given, at * the moment only default is done... - */ + */ #define CSV_COMMENT_CHAR '#' @@ -1087,7 +1087,7 @@ csv_convert_emails(char *s) for(i=1; ( tmp = strchr(s, ',') ) != NULL ; i++, s = tmp + 1 ) if( i > MAX_EMAILS - 1 ) { *tmp = 0; - break; + break; } } @@ -1350,7 +1350,7 @@ csv_export_database(FILE *out, struct db_enumerator e) }; csv_export_common(out, e, csv_export_fields, NULL); - + return 0; } @@ -1408,7 +1408,7 @@ allcsv_export_database(FILE *out, struct db_enumerator e) fprintf(out, "\"CUSTOM5\"\n"); csv_export_common(out, e, allcsv_export_fields, NULL); - + return 0; } @@ -1420,7 +1420,7 @@ allcsv_export_database(FILE *out, struct db_enumerator e) #define PALM_CSV_END CSV_SPECIAL(1) #define PALM_CSV_CAT CSV_SPECIAL(2) -static void +static void palm_split_and_write_name(FILE *out, char *name) { char *p; @@ -1439,7 +1439,7 @@ palm_split_and_write_name(FILE *out, char *name) } } -static void +static void palm_csv_handle_specials(FILE *out, int item, int field) { switch(field) { @@ -1469,7 +1469,7 @@ palm_export_database(FILE *out, struct db_enumerator e) FAX, /* FAX */ MOBILEPHONE, /* OTHER */ EMAIL, /* EMAIL */ - ADDRESS, /* ADDRESS */ + ADDRESS, /* ADDRESS */ CITY, /* CITY */ STATE, /* STATE */ ZIP, /* ZIP */ @@ -1512,25 +1512,25 @@ gcrd_export_database(FILE *out, struct db_enumerator e) for( j = strlen(database[e.item][NAME]) - 1; j >= 0; j-- ) { if(database[e.item][NAME][j] == ' ') break; - } + } fprintf(out, "N:%s;%.*s\n", safe_str(name), j, safe_str(database[e.item][NAME]) - ); + ); free(name); if ( database[e.item][ADDRESS] ) fprintf(out, "ADR:;;%s;%s;%s;%s;%s;%s\n", safe_str(database[e.item][ADDRESS]), - safe_str(database[e.item][ADDRESS2]), + safe_str(database[e.item][ADDRESS2]), safe_str(database[e.item][CITY]), safe_str(database[e.item][STATE]), safe_str(database[e.item][ZIP]), safe_str(database[e.item][COUNTRY]) ); - + if (database[e.item][PHONE]) fprintf(out, "TEL;HOME:%s\n", database[e.item][PHONE]); if (database[e.item][WORKPHONE]) @@ -1543,19 +1543,19 @@ gcrd_export_database(FILE *out, struct db_enumerator e) if ( database[e.item][EMAIL] ) { split_emailstr(e.item, emails); for(j=0; j < MAX_EMAILS ; j++) { - if ( *emails[j] ) + if ( *emails[j] ) fprintf(out, "EMAIL;INTERNET:%s\n", emails[j]); } } - - if ( database[e.item][NOTES] ) + + if ( database[e.item][NOTES] ) fprintf(out, "NOTE:%s\n", database[e.item][NOTES]); if (database[e.item][URL]) fprintf(out, "URL:%s\n", database[e.item][URL]); fprintf(out, "END:VCARD\n\n"); - + } return 0; @@ -1574,7 +1574,7 @@ static char * mutt_alias_genalias(int i) { char *tmp, *pos; - + if(database[i][NICK]) return strdup(database[i][NICK]); @@ -1585,7 +1585,7 @@ mutt_alias_genalias(int i) strlower(tmp); - return tmp; + return tmp; } static int @@ -1627,10 +1627,10 @@ text_write_address_us(FILE *out, int i) { if (database[i][CITY]) fprintf(out, "\n%s", database[i][CITY]); - + if (database[i][STATE] || database[i][ZIP]) { fputc('\n', out); - + if(database[i][STATE]) { fprintf(out, "%s", database[i][STATE]); if(database[i][ZIP]) @@ -1674,7 +1674,7 @@ text_write_address_eu(FILE *out, int i) { if(database[i][CITY]) fprintf(out, "%s", database[i][CITY]); } - + if (database[i][STATE]) fprintf(out, "\n%s", database[i][STATE]); diff --git a/getname.c b/getname.c index 41b8503..3deea8c 100644 --- a/getname.c +++ b/getname.c @@ -102,12 +102,12 @@ spamify(char *input) ** From: [blank From: line] ** From: uu.net!kent [uucp addresses - no comment] ** From: uu.net!kent (kent) [uucp addresses - with comment] -** From: "(Joe Bloggs)" +** From: "(Joe Bloggs)" ** From: "Roy T. Fielding" ** From: kent@localhost ** From: kent@uu.net (Kent Landfield) ** From: (George Burgyan) -** From: (George Burgyan) +** From: (George Burgyan) ** From: Kent B. Landfield ** From: IN%"fekete+reply@c2.net" 26-JAN-1997 13:28:55.36 ** From: IN%"vicric@panix.com" "Vicki Richman" 13-AUG-1996 10:54:33.38 @@ -159,7 +159,7 @@ getname(char *line, char **namep, char **emailp) ** First, is there an '@' sign we can use as an anchor ? */ if ((c = hm_strchr(line, '@')) == NULL) { - /* + /* ** No '@' sign here so ... */ if (strchr(line, '(')) { /* From: bob (The Big Guy) */ @@ -177,7 +177,7 @@ getname(char *line, char **namep, char **emailp) email[i++] = *c; email[i] = '\0'; } else { - /* + /* * - check to see if the From: line is blank, (taken care of) * - check if From: uu.net!kent formatted line * - check if "From: kent" formatted line @@ -197,7 +197,7 @@ getname(char *line, char **namep, char **emailp) else if (use_domainaddr) { /* - * check if site domainizes addresses + * check if site domainizes addresses * but don't modify uucp addresses */ if ((c = strchr(email, '!')) == NULL) { @@ -281,7 +281,7 @@ getname(char *line, char **namep, char **emailp) comment_fnd = 1; } else { /* - * Is there an email address available + * Is there an email address available * that we can use for the name ? */ if (!strcmp(email, NOEMAIL)) /* No */ @@ -326,7 +326,7 @@ getname(char *line, char **namep, char **emailp) name[i] = '\0'; /* - * Is the name string blank ? If so then + * Is the name string blank ? If so then * force it to get filled with something. */ if (blankstring(name)) @@ -341,9 +341,9 @@ getname(char *line, char **namep, char **emailp) strcpymax(name, email, NAMESTRLEN); } - /* - * need to strip spaces off the end of - * the email and name strings + /* + * need to strip spaces off the end of + * the email and name strings */ c = email + (strlen(email) - 1); diff --git a/getopt.c b/getopt.c index 46da471..0a24ce5 100644 --- a/getopt.c +++ b/getopt.c @@ -23,7 +23,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + /* This tells Alpha OSF/1 not to define a getopt prototype in . Ditto for AIX 3.2 and . */ #ifndef _NO_PROTO @@ -198,7 +198,7 @@ ordering; /* Value of POSIXLY_CORRECT environment variable. */ static char *posixly_correct; - + #ifdef __GNU_LIBRARY__ /* We want to avoid inclusion of string.h with non-GNU libraries because there are many ways it can cause trouble. @@ -241,7 +241,7 @@ extern int strlen(const char *); #endif /* __GNUC__ */ #endif /* not __GNU_LIBRARY__ */ - + /* Handle permutation of arguments. */ /* Describe the part of ARGV that contains non-options that have @@ -408,7 +408,7 @@ static const char * return optstring; } - + /* Scan elements of ARGV (whose length is ARGC) for option characters given in OPTSTRING. @@ -933,7 +933,7 @@ int } #endif /* Not ELIDE_CODE. */ - + #ifdef TEST /* Compile with -DTEST to make an executable for use in testing diff --git a/getopt1.c b/getopt1.c index fe414f3..289ed44 100644 --- a/getopt1.c +++ b/getopt1.c @@ -18,7 +18,7 @@ License along with the GNU C Library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ - + #ifdef HAVE_CONFIG_H #include #endif @@ -91,7 +91,7 @@ int } #endif /* Not ELIDE_CODE. */ - + #ifdef TEST #include diff --git a/list.c b/list.c index 9f293e9..31853a4 100644 --- a/list.c +++ b/list.c @@ -82,17 +82,17 @@ void refresh_list() { int i, line; - + werase(list); ui_print_number_of_items(); - + if(items < 1) { refresh(); wrefresh(list); return; } - + if(curitem < 0) curitem = 0; @@ -132,7 +132,7 @@ print_list_line(int i, int line, int highlight) if(selected[i]) mvwaddch(list, line, 0, '*' ); - + mvwaddnstr(list, line, NAMEPOS, database[i][NAME], bytes2width(database[i][NAME], NAMELEN)); if(opt_get_bool(BOOL_SHOW_ALL_EMAILS)) @@ -155,7 +155,7 @@ print_list_line(int i, int line, int highlight) if(highlight) wstandend(list); } - + void list_headerline() @@ -201,10 +201,10 @@ page_up() { if(curitem < 1) return; - + curitem = curitem == first_list_item ? ((curitem -= LIST_LINES) < 0 ? 0 : curitem) : first_list_item; - + refresh_list(); } @@ -267,7 +267,7 @@ goto_home() { if(items > 0) curitem = 0; - + refresh_list(); } diff --git a/misc.c b/misc.c index db2a584..73154e8 100644 --- a/misc.c +++ b/misc.c @@ -85,7 +85,7 @@ mkstr (const char *format, ... ) MY_VA_LOCAL_DECL; size_t size = 100; char *buffer = xmalloc (size); - + assert(format != NULL); for(;;) { @@ -102,7 +102,7 @@ mkstr (const char *format, ... ) size = n + 1; else size *= 2; - + buffer = xrealloc(buffer, size); } } @@ -125,7 +125,7 @@ strconcat (const char *str, ...) MY_VA_SHIFT(s, char*); } MY_VA_END; - + concat = (char *) xmalloc(l); if(concat == NULL) @@ -178,7 +178,7 @@ my_getcwd() return NULL; *dir = 0; - + while( getcwd(dir, size) == NULL && errno == ERANGE ) if( (dir = xrealloc(dir, size *=2)) == NULL) return NULL; @@ -297,9 +297,9 @@ bytes2width(const char *s, int width) * 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 @@ -348,7 +348,7 @@ bytes2width(const char *s, int width) /*int snprintf (char *str, size_t count, const char *fmt, ...);*/ /*int vsnprintf (char *str, size_t count, const char *fmt, va_list arg);*/ -static void dopr (char *buffer, size_t maxlen, const char *format, +static void 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); @@ -401,7 +401,7 @@ static void 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; @@ -409,20 +409,20 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) while (state != DP_S_DONE) { - if ((ch == '\0') || (currlen >= maxlen)) + if ((ch == '\0') || (currlen >= maxlen)) 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; @@ -450,49 +450,49 @@ static void 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: /* Currently, we don't support Long Long, bummer */ - switch (ch) + switch (ch) { case 'h': cflags = DP_C_SHORT; @@ -512,11 +512,11 @@ static void 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); @@ -585,7 +585,7 @@ static void dopr (char *buffer, size_t maxlen, const char *format, va_list args) break; case 's': strvalue = va_arg (args, char *); - if (max < 0) + if (max < 0) max = maxlen; /* ie, no max */ fmtstr (buffer, &currlen, maxlen, strvalue, flags, min, max); break; @@ -594,19 +594,19 @@ static void 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 + } + else { int *num; num = va_arg (args, int *); @@ -636,9 +636,9 @@ static void 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'; } @@ -647,7 +647,7 @@ static void fmtstr (char *buffer, size_t *currlen, size_t maxlen, { int padlen, strln; /* amount to pad */ int cnt = 0; - + if (value == 0) { value = ""; @@ -655,23 +655,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) && (cnt < max)) + while ((padlen > 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); --padlen; ++cnt; } - while (*value && (cnt < max)) + while (*value && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, *value++); ++cnt; } - while ((padlen < 0) && (cnt < max)) + while ((padlen < 0) && (cnt < max)) { dopr_outch (buffer, currlen, maxlen, ' '); ++padlen; @@ -691,7 +691,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; @@ -710,7 +710,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 { @@ -731,7 +731,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 @@ -740,18 +740,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) { @@ -761,9 +761,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, ' '); @@ -790,7 +790,7 @@ static long double pow10 (int exp) result *= 10; exp--; } - + return result; } @@ -816,12 +816,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 */ @@ -845,8 +845,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) @@ -886,18 +886,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; @@ -914,10 +914,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]); /* @@ -926,7 +926,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) @@ -935,7 +935,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; @@ -972,7 +972,7 @@ int snprintf (va_alist) va_dcl char *fmt; #endif VA_LOCAL_DECL; - + VA_START (fmt); VA_SHIFT (str, char *); VA_SHIFT (count, size_t ); @@ -1004,7 +1004,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", @@ -1032,7 +1032,7 @@ int main (void) sprintf (buf2, fp_fmt[x], fp_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", fp_fmt[x], buf1, buf2); fail++; } @@ -1046,7 +1046,7 @@ int main (void) sprintf (buf2, int_fmt[x], int_nums[y]); if (strcmp (buf1, buf2)) { - printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", + printf("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", int_fmt[x], buf1, buf2); fail++; } diff --git a/options.c b/options.c index d43f0e7..7d18f55 100644 --- a/options.c +++ b/options.c @@ -55,11 +55,11 @@ static struct option abook_vars[] = { { "mutt_command", OT_STR, STR_MUTT_COMMAND, UL "mutt" }, { "mutt_return_all_emails", OT_BOOL, BOOL_MUTT_RETURN_ALL_EMAILS, TRUE }, - + { "print_command", OT_STR, STR_PRINT_COMMAND, UL "lpr" }, { "www_command", OT_STR, STR_WWW_COMMAND, UL "lynx" }, - + { "address_style", OT_STR, STR_ADDRESS_STYLE, UL "eu" }, { "use_ascii_only", OT_BOOL, BOOL_USE_ASCII_ONLY, FALSE }, @@ -210,7 +210,7 @@ void find_token_start(buffer *b) { assert(b); - + for(; ISSPACE(*b -> ptr); b -> ptr ++); } @@ -230,7 +230,7 @@ static char * opt_set_set_option(char *var, char *p, struct option *opt) { int len; - + strtrim(p); len = strlen(p); @@ -261,7 +261,7 @@ opt_set_set_option(char *var, char *p, struct option *opt) default: assert(0); } - + return NULL; } @@ -276,13 +276,13 @@ opt_parse_set(buffer *b) *p++ = 0; else return "invalid value assignment"; - + strtrim(b -> ptr); for(i = 0;abook_vars[i].option; i++) if(!strcmp(abook_vars[i].option, b -> ptr)) return opt_set_set_option(b -> ptr, p, &abook_vars[i]); - + return "unknown option"; } @@ -329,7 +329,7 @@ opt_parse_line(char *line, int n, char *fn) char *err = NULL; char *token; buffer b; - + assert(line && fn); b.ptr = line; @@ -354,7 +354,7 @@ opt_parse_line(char *line, int n, char *fn) return FALSE; break; } - + fprintf(stderr, "%s: parse error at line %d: ", fn, n); if(err) fprintf(stderr, "%s\n", err); @@ -371,11 +371,11 @@ load_opts(char *filename) char *line = NULL; int n; int err = 0; - + if((in = fopen(filename, "r")) == NULL) return -1; - + for(n = 1;!feof(in); n++) { line = getaline(in); diff --git a/ui.c b/ui.c index 2799039..8db6b79 100644 --- a/ui.c +++ b/ui.c @@ -88,7 +88,7 @@ resize_abook() fprintf(stderr, "Warning: COLS=%d, LINES=%d\n", winsz.ws_col, winsz.ws_row); } #endif - + if(winsz.ws_col >= MIN_COLS && winsz.ws_row >= MIN_LINES) { #ifdef HAVE_RESIZETERM resizeterm(winsz.ws_row, winsz.ws_col); @@ -115,7 +115,7 @@ win_changed(int i) if( can_resize ) resize_abook(); else - should_resize = TRUE; + should_resize = TRUE; } #endif /* SIGWINCH */ @@ -217,7 +217,7 @@ int statusline_msg(char *msg) { int c; - + clear_statusline(); statusline_addstr(msg); c = getch(); @@ -475,7 +475,7 @@ ui_remove_items() if(statusline_ask_boolean("Remove selected item(s)", TRUE)) remove_selected_items(); - clear_statusline(); + clear_statusline(); refresh_list(); } @@ -575,7 +575,7 @@ ui_print_database() return; fexport("text", handle, mode); - + pclose(handle); }