[PATCH 1/2] Normalized whitespace in Makefile.am, mdb-export.c, and mdb-schema.c.
David Favro <[email protected]> Fri, 29 Oct 2010 13:25:10 -0400
| Newsgroups | gmane.comp.db.mdb-tools.devel |
|---|---|
| Message-ID | <[email protected]> |
Signed-off-by: David Favro <[email protected]> --- src/util/Makefile.am | 6 +++--- src/util/mdb-export.c | 24 ++++++++++++------------ src/util/mdb-schema.c | 39 +++++++++++++++++++-------------------- 3 files changed, 34 insertions(+), 35 deletions(-) diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 6e9e413..c872aec 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -1,9 +1,9 @@ -bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql mdb-ver mdb-prop +bin_PROGRAMS = mdb-export mdb-array mdb-schema mdb-tables mdb-parsecsv mdb-header mdb-sql mdb-ver mdb-prop noinst_PROGRAMS = mdb-import prtable prcat prdata prkkd prdump prole updrow prindex -LIBS = $(GLIB_LIBS) @LIBS@ @LEXLIB@ +LIBS = $(GLIB_LIBS) @LIBS@ @LEXLIB@ DEFS = @DEFS@ -DLOCALEDIR=\"$(localedir)\" AM_CPPFLAGS = -I$(top_srcdir)/include $(GLIB_CFLAGS) -LDADD = ../libmdb/libmdb.la +LDADD = ../libmdb/libmdb.la if SQL mdb_sql_LDADD = ../libmdb/libmdb.la ../sql/libmdbsql.la $(LIBREADLINE) endif diff --git a/src/util/mdb-export.c b/src/util/mdb-export.c index a484a01..8aa5290 100644 --- a/src/util/mdb-export.c +++ b/src/util/mdb-export.c @@ -2,7 +2,7 @@ * Copyright (C) 2000 Brian Bruns * * - * This library is free software; you can redistribute it and/or + * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Library General Public * License as published by the Free Software Foundation; either * version 2 of the License, or (at your option) any later version. @@ -62,7 +62,7 @@ main(int argc, char **argv) MdbTableDef *table; MdbColumn *col; char **bound_values; - int *bound_lens; + int *bound_lens; char *delimiter = NULL; char *row_delimiter = NULL; char *quote_char = NULL; @@ -116,10 +116,10 @@ main(int argc, char **argv) if (!row_delimiter) { row_delimiter = (char *) g_strdup("\n"); } - - /* - ** optind is now the position of the first non-option arg, - ** see getopt(3) + + /* + ** optind is now the position of the first non-option arg, + ** see getopt(3) */ if (argc-optind < 2) { fprintf(stderr,"Usage: %s [options] <file> <table>\n",argv[0]); @@ -165,7 +165,7 @@ main(int argc, char **argv) mdb_read_columns(table); mdb_rewind_table(table); - + bound_values = (char **) g_malloc(table->num_cols * sizeof(char *)); bound_lens = (int *) g_malloc(table->num_cols * sizeof(int)); for (j=0;j<table->num_cols;j++) { @@ -192,7 +192,7 @@ main(int argc, char **argv) if (j>0) fprintf(stdout, ", "); col=g_ptr_array_index(table->columns,j); fprintf(stdout,"%s", sanitize_name(col->name,sanitize)); - } + } fprintf(stdout, ") VALUES ("); } @@ -238,15 +238,15 @@ static char *sanitize_name(char *str, int sanitize) if (!sanitize) return str; - + while (*str) { *p = isalnum(*str) ? *str : '_'; p++; str++; } - + *p = 0; - + return namebuf; } @@ -263,7 +263,7 @@ static char *escapes(char *s) case 't': *t++='\t'; break; case 'r': *t++='\r'; break; default: *t++='\\'; *t++=*s; break; - } + } encode=0; } else if (*s=='\\') { encode=1; diff --git a/src/util/mdb-schema.c b/src/util/mdb-schema.c index 012bb2f..b142711 100644 --- a/src/util/mdb-schema.c +++ b/src/util/mdb-schema.c @@ -61,7 +61,7 @@ main (int argc, char **argv) break; } } - + mdb_init(); /* open the database */ @@ -81,7 +81,7 @@ main (int argc, char **argv) } /* read the catalog */ - if (!mdb_read_catalog (mdb, MDB_TABLE)) { + if (!mdb_read_catalog (mdb, MDB_TABLE)) { fprintf(stderr,"File does not appear to be an Access database\n"); exit(1); } @@ -99,7 +99,7 @@ main (int argc, char **argv) for (i=0; i < mdb->num_catalog; i++) { entry = g_ptr_array_index (mdb->catalog, i); if (entry->object_type == MDB_TABLE) { - if ((tabname && !strcmp(entry->object_name, tabname)) + if ((tabname && !strcmp(entry->object_name, tabname)) || (!tabname && mdb_is_user_table(entry))) { generate_table_schema(entry, namespace, s); } @@ -112,8 +112,8 @@ main (int argc, char **argv) while ((the_relation=mdb_get_relationships(mdb)) != NULL) { fprintf(stdout,"%s\n",the_relation); g_free(the_relation); - } - + } + g_free(namespace); g_free(tabname); mdb_close (mdb); @@ -137,7 +137,7 @@ generate_table_schema(MdbCatalogEntry *entry, char *namespace, int sanitize) fprintf (stdout, "CREATE TABLE %s%s\n", (namespace) ? namespace : "", sanitize_name(entry->object_name, sanitize)); fprintf (stdout, " (\n"); - + table = mdb_read_table (entry); /* get the columns */ @@ -147,20 +147,20 @@ generate_table_schema(MdbCatalogEntry *entry, char *namespace, int sanitize) for (i = 0; i < table->num_cols; i++) { col = g_ptr_array_index (table->columns, i); - - fprintf (stdout, "\t%s\t\t\t%s", sanitize_name(col->name,sanitize), + + fprintf (stdout, "\t%s\t\t\t%s", sanitize_name(col->name,sanitize), mdb_get_coltype_string (mdb->default_backend, col->col_type)); - - if (mdb_coltype_takes_length(mdb->default_backend, + + if (mdb_coltype_takes_length(mdb->default_backend, col->col_type)) { - /* more portable version from DW patch */ - if (col->col_size == 0) - fprintf (stdout, " (255)"); - else - fprintf (stdout, " (%d)", col->col_size); + /* more portable version from DW patch */ + if (col->col_size == 0) + fprintf (stdout, " (255)"); + else + fprintf (stdout, " (%d)", col->col_size); } - + if (i < table->num_cols - 1) fprintf (stdout, ", \n"); else @@ -181,15 +181,14 @@ static char *sanitize_name(char *str, int sanitize) if (!sanitize) return str; - + while (*str) { *p = isalnum(*str) ? *str : '_'; p++; str++; } - + *p = 0; - + return namebuf; } - -- 1.7.0.4 ------------------------------------------------------------------------------ Nokia and AT&T present the 2010 Calling All Innovators-North America contest Create new apps & games for the Nokia N8 for consumers in U.S. and Canada $10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store http://p.sf.net/sfu/nokia-dev2dev