From c8c0bf74805c61b1379dab1d4529df0004872bb4 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Mon, 18 Mar 2013 14:39:04 +0100 Subject: tdb: Fix blank line endings Signed-off-by: Volker Lendecke Reviewed-by: Stefan Metzmacher --- lib/tdb/tools/tdbbackup.c | 27 +++++++++++++-------------- lib/tdb/tools/tdbdump.c | 8 ++++---- lib/tdb/tools/tdbtest.c | 12 ++++++------ lib/tdb/tools/tdbtool.c | 40 ++++++++++++++++++++-------------------- lib/tdb/tools/tdbtorture.c | 4 ++-- 5 files changed, 45 insertions(+), 46 deletions(-) diff --git a/lib/tdb/tools/tdbbackup.c b/lib/tdb/tools/tdbbackup.c index 11ecaa0290..276a281e46 100644 --- a/lib/tdb/tools/tdbbackup.c +++ b/lib/tdb/tools/tdbbackup.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. low level tdb backup and restore utility Copyright (C) Andrew Tridgell 2002 @@ -7,12 +7,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -61,7 +61,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const char *format, ...) { va_list ap; - + va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); @@ -122,7 +122,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) } /* open the old tdb */ - tdb = tdb_open_ex(old_name, 0, 0, + tdb = tdb_open_ex(old_name, 0, 0, O_RDWR, 0, &log_ctx, NULL); if (!tdb) { printf("Failed to open %s\n", old_name); @@ -132,10 +132,10 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) /* create the new tdb */ unlink(tmp_name); - tdb_new = tdb_open_ex(tmp_name, - hash_size ? hash_size : tdb_hash_size(tdb), - TDB_DEFAULT, - O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, + tdb_new = tdb_open_ex(tmp_name, + hash_size ? hash_size : tdb_hash_size(tdb), + TDB_DEFAULT, + O_RDWR|O_CREAT|O_EXCL, st.st_mode & 0777, &log_ctx, NULL); if (!tdb_new) { perror(tmp_name); @@ -192,9 +192,9 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) /* close the new tdb and re-open read-only */ tdb_close(tdb_new); - tdb_new = tdb_open_ex(tmp_name, + tdb_new = tdb_open_ex(tmp_name, 0, - TDB_DEFAULT, + TDB_DEFAULT, O_RDONLY, 0, &log_ctx, NULL); if (!tdb_new) { @@ -204,7 +204,7 @@ static int backup_tdb(const char *old_name, const char *new_name, int hash_size) free(tmp_name); return 1; } - + /* traverse the new tdb to confirm */ count2 = tdb_traverse(tdb_new, test_fn, NULL); if (count2 != count1) { @@ -237,7 +237,7 @@ static int verify_tdb(const char *fname, const char *bak_name) int count = -1; /* open the tdb */ - tdb = tdb_open_ex(fname, 0, 0, + tdb = tdb_open_ex(fname, 0, 0, O_RDONLY, 0, &log_ctx, NULL); /* traverse the tdb, then close it */ @@ -280,7 +280,6 @@ static void usage(void) printf(" -v verify mode (restore if corrupt)\n"); printf(" -n hashsize set the new hash size for the backup\n"); } - int main(int argc, char *argv[]) { diff --git a/lib/tdb/tools/tdbdump.c b/lib/tdb/tools/tdbdump.c index 47a84d286b..e66ea5685b 100644 --- a/lib/tdb/tools/tdbdump.c +++ b/lib/tdb/tools/tdbdump.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. simple tdb dump util Copyright (C) Andrew Tridgell 2001 @@ -7,12 +7,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -99,7 +99,7 @@ static int dump_tdb(const char *fname, const char *keyname, bool emergency) TDB_CONTEXT *tdb; TDB_DATA key, value; struct tdb_logging_context logfn = { log_stderr }; - + tdb = tdb_open_ex(fname, 0, 0, O_RDONLY, 0, &logfn, NULL); if (!tdb) { printf("Failed to open %s\n", fname); diff --git a/lib/tdb/tools/tdbtest.c b/lib/tdb/tools/tdbtest.c index 44c78efda5..0be35dc303 100644 --- a/lib/tdb/tools/tdbtest.c +++ b/lib/tdb/tools/tdbtest.c @@ -24,7 +24,7 @@ static void _start_timer(void) static double _end_timer(void) { gettimeofday(&tp2,NULL); - return((tp2.tv_sec - tp1.tv_sec) + + return((tp2.tv_sec - tp1.tv_sec) + (tp2.tv_usec - tp1.tv_usec)*1.0e-6); } @@ -40,7 +40,7 @@ static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...) static void tdb_log(struct tdb_context *tdb, int level, const char *format, ...) { va_list ap; - + va_start(ap, format); vfprintf(stdout, format, ap); va_end(ap); @@ -189,15 +189,15 @@ static void merge_test(void) char keys[5][2]; char tdata[] = "test"; TDB_DATA key, data; - + for (i = 0; i < 5; i++) { snprintf(keys[i],2, "%d", i); key.dptr = keys[i]; key.dsize = 2; - + data.dptr = tdata; data.dsize = 4; - + if (tdb_store(db, key, data, TDB_REPLACE) != 0) { fatal("tdb_store failed"); } @@ -248,7 +248,7 @@ static char *test_path(const char *filename) db = tdb_open(test_tdb, 0, TDB_CLEAR_IF_FIRST, O_RDWR | O_CREAT | O_TRUNC, 0600); - gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST, + gdbm = gdbm_open(test_gdbm, 512, GDBM_WRITER|GDBM_NEWDB|GDBM_FAST, 0600, NULL); if (!db || !gdbm) { diff --git a/lib/tdb/tools/tdbtool.c b/lib/tdb/tools/tdbtool.c index dc5747f87a..d00779611c 100644 --- a/lib/tdb/tools/tdbtool.c +++ b/lib/tdb/tools/tdbtool.c @@ -1,4 +1,4 @@ -/* +/* Unix SMB/CIFS implementation. Samba database functions Copyright (C) Andrew Tridgell 1999-2000 @@ -10,12 +10,12 @@ it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. - + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. - + You should have received a copy of the GNU General Public License along with this program. If not, see . */ @@ -113,7 +113,7 @@ static void _start_timer(void) static double _end_timer(void) { gettimeofday(&tp2,NULL); - return((tp2.tv_sec - tp1.tv_sec) + + return((tp2.tv_sec - tp1.tv_sec) + (tp2.tv_usec - tp1.tv_usec)*1.0e-6); } @@ -160,7 +160,7 @@ static void print_data(const char *buf,int len) printf("%02X ",(int)((unsigned char)buf[i])); i++; if (i%8 == 0) printf(" "); - if (i%16 == 0) { + if (i%16 == 0) { print_asc(&buf[i-16],8); printf(" "); print_asc(&buf[i-8],8); printf("\n"); if (i8) printf(" "); while (n--) printf(" "); - + n = i%16; if (n > 8) n = 8; print_asc(&buf[i-(i%16)],n); printf(" "); n = (i%16) - n; - if (n>0) print_asc(&buf[i-n],n); - printf("\n"); + if (n>0) print_asc(&buf[i-n],n); + printf("\n"); } } @@ -309,11 +309,11 @@ static void show_tdb(char *keyname, size_t keylen) terror("fetch failed"); return; } - + print_rec(tdb, key, dbuf, NULL); - + free( dbuf.dptr ); - + return; } @@ -357,23 +357,23 @@ static void move_rec(char *keyname, size_t keylen, char* tdbname) terror("fetch failed"); return; } - + print_rec(tdb, key, dbuf, NULL); - + dst_tdb = tdb_open(tdbname, 0, 0, O_RDWR, 0600); if ( !dst_tdb ) { terror("unable to open destination tdb"); return; } - + if (tdb_store( dst_tdb, key, dbuf, TDB_REPLACE ) != 0) { terror("failed to move record"); } else printf("record moved\n"); - + tdb_close( dst_tdb ); - + return; } @@ -520,7 +520,7 @@ static void first_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) { TDB_DATA dbuf; *pkey = tdb_firstkey(the_tdb); - + dbuf = tdb_fetch(the_tdb, *pkey); if (!dbuf.dptr) terror("fetch failed"); else { @@ -532,9 +532,9 @@ static void next_record(TDB_CONTEXT *the_tdb, TDB_DATA *pkey) { TDB_DATA dbuf; *pkey = tdb_nextkey(the_tdb, *pkey); - + dbuf = tdb_fetch(the_tdb, *pkey); - if (!dbuf.dptr) + if (!dbuf.dptr) terror("fetch failed"); else print_rec(the_tdb, *pkey, dbuf, NULL); diff --git a/lib/tdb/tools/tdbtorture.c b/lib/tdb/tools/tdbtorture.c index 760ad59313..a23d1543e5 100644 --- a/lib/tdb/tools/tdbtorture.c +++ b/lib/tdb/tools/tdbtorture.c @@ -1,5 +1,5 @@ /* this tests tdb by doing lots of ops from several simultaneous - writers - that stresses the locking code. + writers - that stresses the locking code. */ #include "replace.h" @@ -59,7 +59,7 @@ static void tdb_log(struct tdb_context *tdb, enum tdb_debug_level level, const c system(ptr); free(ptr); } -#endif +#endif } static void fatal(const char *why) -- cgit