From 2778968580da052b2ba8be0c8fc693e7d3994bba Mon Sep 17 00:00:00 2001 From: Miek Gieben Date: Sun, 4 Apr 2010 14:29:57 +0200 Subject: [PATCH] more eol whitespace --- abspath.c | 6 ++--- base64.c | 68 ++++++++++++++++++++++++++--------------------------- child.c | 18 +++++++------- crawler.c | 16 ++++++------- crypt.c | 24 +++++++++---------- dir.c | 4 ++-- entry.c | 56 +++++++++++++++++++++---------------------- fs-up.c | 46 ++++++++++++++++++------------------ getdelim.c | 2 +- gfunc.c | 48 ++++++++++++++++++------------------- link.c | 2 +- mkpath.c | 6 ++--- names.c | 8 +++---- protocol.c | 32 ++++++++++++------------- rdup-tr.c | 42 ++++++++++++++++----------------- rdup-up.c | 12 +++++----- rdup.c | 46 ++++++++++++++++++------------------ regexp.c | 6 ++--- reverse.c | 6 ++--- rm.c | 4 ++-- sha1.c | 2 +- signal.c | 2 +- strippath.c | 6 ++--- xattr.c | 4 ++-- 24 files changed, 233 insertions(+), 233 deletions(-) diff --git a/abspath.c b/abspath.c index e0140065..4b5c3572 100644 --- a/abspath.c +++ b/abspath.c @@ -2,7 +2,7 @@ /* * Remove /./ and /../ and // from a pathname - * An absolute pathname argument is required. + * An absolute pathname argument is required. * Returns NULL on error, otherwise NULL terminated * sanitized pathname. * @@ -21,8 +21,8 @@ char * abspath(char *path) if (!g_path_is_absolute(path)) return NULL; - /* abspath can be NULL or abspath[0] == '\0'. The NULL - * is initial. the [0] == '\0' is when we got back to + /* abspath can be NULL or abspath[0] == '\0'. The NULL + * is initial. the [0] == '\0' is when we got back to * the root */ abspath = NULL; diff --git a/base64.c b/base64.c index f5e84faf..1230c8c6 100644 --- a/base64.c +++ b/base64.c @@ -27,10 +27,10 @@ static char encode(unsigned char u); static unsigned char decode(char c); /** - * Implementation of base64 encoding/decoding. + * Implementation of base64 encoding/decoding. * @author Jan-Henrik Haukeland, * @version \$Id: base64.c,v 1.19 2007/07/25 12:54:31 hauk Exp $ - * + * */ /** @@ -40,8 +40,8 @@ static unsigned char decode(char c); * @param src The data to be base64 encode * @return encoded string otherwise NULL */ -char -*encode_base64(int size, unsigned char *src) +char +*encode_base64(int size, unsigned char *src) { int i; char *out, *p; @@ -51,36 +51,36 @@ char if(!size) size= strlen((char *)src); - + out = g_malloc0(size*4/3+4); p = out; - + for(i=0; i>2; b5= ((b1&0x3)<<4)|(b2>>4); b6= ((b2&0xf)<<2)|(b3>>6); b7= b3&0x3f; - + *p++= encode(b4); *p++= encode(b5); - + if(i+1>4) ); - + if(c3 != '=') { *p++=(((b2&0xf)<<4)|(b3>>2) ); } @@ -147,7 +147,7 @@ decode_base64(unsigned char *dest, const char *src) *p++=(((b3&0x3)<<6)|b4 ); } } - + g_free(buf); return(p-dest); } @@ -157,14 +157,14 @@ decode_base64(unsigned char *dest, const char *src) /** * Base64 encode one byte */ -static char -encode(unsigned char u) +static char +encode(unsigned char u) { if(u < 26) return 'A'+u; if(u < 52) return 'a'+(u-26); if(u < 62) return '0'+(u-52); if(u == 62) return '-'; /* was + */ - + /* return '/'; */ return '_'; } @@ -172,8 +172,8 @@ encode(unsigned char u) /** * Decode a base64 character */ -static unsigned char -decode(char c) +static unsigned char +decode(char c) { if(c >= 'A' && c <= 'Z') return(c - 'A'); if(c >= 'a' && c <= 'z') return(c - 'a' + 26); @@ -185,8 +185,8 @@ decode(char c) /** * Return TRUE if 'c' is a valid base64 character, otherwise FALSE */ -static int -is_base64(char c) +static int +is_base64(char c) { if((c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z') || (c >= '0' && c <= '9') || (c == '-') || diff --git a/child.c b/child.c index 9e56e7c9..d5619b48 100644 --- a/child.c +++ b/child.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * child.c handle child stuff */ @@ -18,7 +18,7 @@ close_pipes(GSList *pipes, int n1, int n2) int *q; int j; - for (j = 0, p = g_slist_nth(pipes, 0); p; p = p->next, j++) { + for (j = 0, p = g_slist_nth(pipes, 0); p; p = p->next, j++) { q = p->data; /* msg("Pipe set %d fds %d %d", j, q[0], q[1]); */ if (j == n1 || j == n2) @@ -32,10 +32,10 @@ close_pipes(GSList *pipes, int n1, int n2) int wait_pids(GSList *pids, int flags) { - GSList *p; + GSList *p; int status; - for (p = g_slist_nth(pids, 0); p; p = p->next) { + for (p = g_slist_nth(pids, 0); p; p = p->next) { if (sig != 0) signal_abort(sig); @@ -47,7 +47,7 @@ wait_pids(GSList *pids, int flags) waitpid(*(pid_t* )(p->data), &status, flags); /* errno ECHILD is ok */ #if 0 if (WIFEXITED(status)) { - /* msg("Child exit %d", WEXITSTATUS(status)); + /* msg("Child exit %d", WEXITSTATUS(status)); if (WEXITSTATUS(status) != 0) ret = -1; */ @@ -63,7 +63,7 @@ wait_pids(GSList *pids, int flags) /* create pipes and childs, return pids */ GSList * -create_childeren(GSList *child, GSList **pipes, int file) +create_childeren(GSList *child, GSList **pipes, int file) { GSList *p; GSList *pids = NULL; @@ -77,13 +77,13 @@ create_childeren(GSList *child, GSList **pipes, int file) if (!child) return NULL; - /* create all pipes before forking + /* create all pipes before forking * As a parent we read from the last pipe created * We attach file to the input of the first child * This eliminates to use of a tmp file */ childs = g_slist_length(child); - for (j = 0; j < childs; j++) { + for (j = 0; j < childs; j++) { pips = g_malloc(2 * sizeof(int)); if (pipe(pips) == -1) { msg(_("Failure creating pipes")); @@ -92,7 +92,7 @@ create_childeren(GSList *child, GSList **pipes, int file) cpipe = g_slist_append(cpipe, pips); } - for (j = 0, p = g_slist_nth(child, 0); p; p = p->next, j++) { + for (j = 0, p = g_slist_nth(child, 0); p; p = p->next, j++) { if (sig != 0) signal_abort(sig); diff --git a/crawler.c b/crawler.c index ca3a4dcb..9d220a4e 100644 --- a/crawler.c +++ b/crawler.c @@ -123,7 +123,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, #else if (fstat(rdup_dirfd(dir), &s) != 0) { #endif - msg(_("Cannot determine holding device of the directory `%s\': %s"), path, + msg(_("Cannot determine holding device of the directory `%s\': %s"), path, strerror(errno)); closedir(dir); g_free(dirstack); @@ -132,7 +132,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, current_dev = s.st_dev; while((dent = readdir(dir))) { - if (!strcmp(dent->d_name, ".") || + if (!strcmp(dent->d_name, ".") || !strcmp(dent->d_name, "..")) continue; @@ -156,7 +156,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, continue; } - if (S_ISREG(s.st_mode) || S_ISLNK(s.st_mode) || + if (S_ISREG(s.st_mode) || S_ISLNK(s.st_mode) || S_ISBLK(s.st_mode) || S_ISCHR(s.st_mode) || S_ISFIFO(s.st_mode) || S_ISSOCK(s.st_mode) ) { @@ -206,7 +206,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, pop.f_lnk = 1; } } - if (S_ISLNK(s.st_mode)) + if (S_ISLNK(s.st_mode)) pop.f_target = slink(&pop); @@ -233,7 +233,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, continue; } dirstack[d] = g_malloc(sizeof(struct rdup)); - dirstack[d]->f_name = g_strdup(curpath); + dirstack[d]->f_name = g_strdup(curpath); dirstack[d]->f_target = NULL; dirstack[d]->f_name_size = curpath_len; dirstack[d]->f_uid = s.st_uid; @@ -251,8 +251,8 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, dirstack[d]->f_lnk = 0; if (d++ % D_STACKSIZE == 0) { - dirstack = g_realloc(dirstack, - ++dstack_cnt * D_STACKSIZE * + dirstack = g_realloc(dirstack, + ++dstack_cnt * D_STACKSIZE * sizeof(struct rdup *)); } g_free(curpath); @@ -277,7 +277,7 @@ dir_crawl(GTree *t, GHashTable *linkhash, GHashTable *userhash, } while (d > 0) { - directory = dirstack[--d]; + directory = dirstack[--d]; g_tree_insert(t, (gpointer) entry_dup(directory), VALUE); /* recurse */ /* potentially expensive operation. Better would be to when we hit diff --git a/crypt.c b/crypt.c index 5a162cc5..659edb6a 100644 --- a/crypt.c +++ b/crypt.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * crypt.c * encrypt/decrypt paths @@ -13,12 +13,12 @@ extern guint opt_verbose; -/** +/** * init the cryto * with key *key * and length length * lenght MUST be 16, 24 or 32 - * anything short will be zero padded to + * anything short will be zero padded to * create a correct key * return aes context */ @@ -29,7 +29,7 @@ crypt_init(gchar *key, gboolean crypt) struct aes_ctx *ctx = g_malloc(sizeof(struct aes_ctx)); if (crypt) aes_set_encrypt_key(ctx, length, (uint8_t*)key); - else + else aes_set_decrypt_key(ctx, length, (uint8_t*)key); return ctx; } @@ -84,7 +84,7 @@ crypt_path_ele(struct aes_ctx *ctx, gchar *elem, GHashTable *tr) len = strlen(elem); hashed = g_hash_table_lookup(tr, elem); - if (hashed) + if (hashed) return hashed; aes_size = ( (len / AES_BLOCK_SIZE) + 1) * AES_BLOCK_SIZE; @@ -149,7 +149,7 @@ decrypt_path_ele(struct aes_ctx *ctx, char *b64, GHashTable *tr) /* we could have gotten valid string to begin with * if the result is now garbled instead of nice plain - * text assume this was the case. + * text assume this was the case. */ if (!is_plain((char*) dest)) { if (opt_verbose > 2) @@ -157,12 +157,12 @@ decrypt_path_ele(struct aes_ctx *ctx, char *b64, GHashTable *tr) g_free(dest); dest = (guchar*) g_strdup(b64); - } + } g_hash_table_insert(tr, b64, dest); return (gchar*) dest; } -/** +/** * encrypt an entire path */ gchar * @@ -190,7 +190,7 @@ crypt_path(struct aes_ctx *ctx, gchar *p, GHashTable *tr) if (xpath) xpath = g_strdup_printf("%s/%s", xpath, crypt); - else + else abs ? (xpath = g_strdup_printf("/%s", crypt)) : (xpath = g_strdup(crypt)); q = c; @@ -199,7 +199,7 @@ crypt_path(struct aes_ctx *ctx, gchar *p, GHashTable *tr) crypt = crypt_path_ele(ctx, q, tr); if (xpath) xpath = g_strdup_printf("%s/%s", xpath, crypt); - else + else abs ? (xpath = g_strdup_printf("/%s", crypt)) : (xpath = g_strdup(crypt)); return xpath; @@ -232,7 +232,7 @@ decrypt_path(struct aes_ctx *ctx, gchar *x, GHashTable *tr) } plain = decrypt_path_ele(ctx, q, tr); - if (path) + if (path) path = g_strdup_printf("%s/%s", path, plain); else abs ? (path = g_strdup_printf("/%s", plain)) : @@ -241,7 +241,7 @@ decrypt_path(struct aes_ctx *ctx, gchar *x, GHashTable *tr) *c = d; } plain = decrypt_path_ele(ctx, q, tr); - if (path) + if (path) path = g_strdup_printf("%s/%s", path, plain); else abs ? (path = g_strdup_printf("/%s", plain)) : diff --git a/dir.c b/dir.c index 589d62e9..16c374db 100644 --- a/dir.c +++ b/dir.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * See LICENSE for the license * make a dir writable and later remove that @@ -58,7 +58,7 @@ dir_parent(gchar *p) return p; copy = g_strdup(p); - n = strrchr(copy, '/'); + n = strrchr(copy, '/'); if (n) { *(n+1) = '\0'; p2 = g_strdup(copy); diff --git a/entry.c b/entry.c index bbc28a7d..05723f76 100644 --- a/entry.c +++ b/entry.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * parse_entry.c * parse an standard rdup entry and return a @@ -34,7 +34,7 @@ extern gchar *opt_decrypt_key; * the-end */ struct rdup * -parse_entry(char *buf, size_t l) +parse_entry(char *buf, size_t l) { struct rdup *e; struct stat *s; @@ -66,7 +66,7 @@ parse_entry(char *buf, size_t l) e->f_mtime = s->st_mtime; e->f_atime = s->st_atime; - /* you will loose hardlink information here + /* you will loose hardlink information here * as 'stat' cannot check this */ if (S_ISLNK(e->f_mode)) e->f_target = slink(e); @@ -198,7 +198,7 @@ parse_entry(char *buf, size_t l) major = atoi(pos); minor = atoi(n + 1); e->f_size = 0; e->f_rdev = makedev(major, minor); - } else + } else e->f_size = atoi(pos); break; @@ -238,7 +238,7 @@ rdup_write_header(struct rdup *e) if (t == 'b' || t == 'c') { /* device */ - out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %d,%d\n%s", + out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %d,%d\n%s", e->plusmin == PLUS ? '+':'-', t, (int)e->f_mode & ~S_IFMT, @@ -255,7 +255,7 @@ rdup_write_header(struct rdup *e) gchar *n; n = g_strdup_printf("%s -> %s", e->f_name, e->f_target); e->f_name_size = strlen(n); - out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %zd\n%s", + out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %zd\n%s", e->plusmin == PLUS ? '+':'-', t, (int)e->f_mode & ~S_IFMT, @@ -267,7 +267,7 @@ rdup_write_header(struct rdup *e) (unsigned long)e->f_name_size, (size_t)e->f_size, n); } else { - out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %zd\n%s", + out = g_strdup_printf("%c%c %.4o %ld %ld %s %ld %s %ld %zd\n%s", e->plusmin == PLUS ? '+':'-', t, (int)e->f_mode & ~S_IFMT, @@ -281,7 +281,7 @@ rdup_write_header(struct rdup *e) e->f_name); } - if (sig != 0) + if (sig != 0) signal_abort(sig); if (write(1, out, strlen(out)) == -1) { @@ -292,7 +292,7 @@ rdup_write_header(struct rdup *e) } gint -rdup_write_data(__attribute__((unused)) struct rdup *e, char *buf, size_t len) +rdup_write_data(__attribute__((unused)) struct rdup *e, char *buf, size_t len) { if (block_out_header(NULL, len, 1) == -1 || block_out(NULL, len, buf, 1) == -1) @@ -320,18 +320,18 @@ stat_from_rdup(struct rdup *e) /* struct stat { - dev_t st_dev; - ino_t st_ino; - mode_t st_mode; - nlink_t st_nlink; - uid_t st_uid; - gid_t st_gid; - dev_t st_rdev; - off_t st_size; - blksize_t st_blksize; - blkcnt_t st_blocks; - time_t st_atime; - time_t st_mtime; + dev_t st_dev; + ino_t st_ino; + mode_t st_mode; + nlink_t st_nlink; + uid_t st_uid; + gid_t st_gid; + dev_t st_rdev; + off_t st_size; + blksize_t st_blksize; + blkcnt_t st_blocks; + time_t st_atime; + time_t st_mtime; time_t st_ctime; } */ @@ -349,7 +349,7 @@ strtime(time_t time, gchar *str) /* stolen from coreutils */ static void -rdup_strmode(mode_t mode, gchar *str) +rdup_strmode(mode_t mode, gchar *str) { str[0] = mode & S_IRUSR ? 'r' : '-'; str[1] = mode & S_IWUSR ? 'w' : '-'; @@ -370,8 +370,8 @@ rdup_strmode(mode_t mode, gchar *str) str[10] = '\0'; } -/* - * write a table of contents (ala gnu tar) entry to stdout +/* + * write a table of contents (ala gnu tar) entry to stdout * -/+drwxr-xr-x miekg/miekg 0 2009-10-30 08:37 home/miekg/bin2/ */ @@ -405,12 +405,12 @@ rdup_write_table(struct rdup *e, FILE *f) if (sig != 0) signal_abort(sig); /* user/group */ - if (e->f_user) + if (e->f_user) fprintf(f, " %s/", e->f_user); else fprintf(f, " %ld/", (unsigned long)e->f_uid); - if (e->f_group) + if (e->f_group) fprintf(f, "%s ", e->f_group); else fprintf(f, "%ld ", (unsigned long)e->f_gid); @@ -422,10 +422,10 @@ rdup_write_table(struct rdup *e, FILE *f) /* correctly recover original filesize for the link */ fprintf(f, "% 9ld ", (unsigned long)(e->f_name_size - e->f_size - 4)); } else if (S_ISCHR(e->f_mode) || S_ISBLK(e->f_mode)) { - fprintf(f, "% 6d,%d ", (unsigned int)major(e->f_rdev), + fprintf(f, "% 6d,%d ", (unsigned int)major(e->f_rdev), (unsigned int)minor(e->f_rdev)); } else { - fprintf(f, "% 9ld ", (unsigned long)e->f_size); + fprintf(f, "% 9ld ", (unsigned long)e->f_size); } if (sig != 0) signal_abort(sig); diff --git a/fs-up.c b/fs-up.c index 6013a7c4..88fea940 100644 --- a/fs-up.c +++ b/fs-up.c @@ -1,7 +1,7 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * See LICENSE for the license - * rdup-up -- update an directory tree with + * rdup-up -- update an directory tree with * and rdup archive * * File related functions @@ -28,7 +28,7 @@ mk_time(struct rdup *e) /* we don't carry the a_time, how cares anyway with noatime? */ ut.actime = ut.modtime = e->f_mtime; - if (utime(e->f_name, &ut) == -1) + if (utime(e->f_name, &ut) == -1) msgd(__func__, __LINE__,_("Failed to set mtime '%s\': %s"), e->f_name, strerror(errno)); return TRUE; } @@ -42,20 +42,20 @@ mk_chown(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) /* Capabilities under Linux?? TODO */ if (getuid() == 0) - if (lchown(e->f_name, u, g) == -1) + if (lchown(e->f_name, u, g) == -1) msgd(__func__, __LINE__,_("Failed to chown `%s\': %s"), e->f_name, strerror(errno)); return TRUE; } static gboolean -mk_mode(struct rdup *e) +mk_mode(struct rdup *e) { chmod(e->f_name, e->f_mode); return TRUE; } static gboolean -mk_meta(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) +mk_meta(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { mk_mode(e); mk_chown(e, uidhash, gidhash); @@ -64,7 +64,7 @@ mk_meta(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) } static gboolean -mk_dev(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) +mk_dev(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { gchar *parent; struct stat *st; @@ -97,7 +97,7 @@ mk_dev(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) } static gboolean -mk_sock(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) +mk_sock(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { gchar *parent; struct stat *st; @@ -153,7 +153,7 @@ mk_link(struct rdup *e, char *p, GHashTable *uidhash, GHashTable *gidhash) dir_restore(parent, st); g_free(parent); return FALSE; - } + } dir_restore(parent, st); g_free(parent); } else { @@ -177,14 +177,14 @@ static gboolean mk_reg(FILE *in, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { FILE *out = NULL; - char *buf; + char *buf; gchar *parent; size_t bytes; gboolean ok = TRUE; gboolean old_dry = opt_dry; struct stat *st; - /* with opt_dry we can't just return TRUE; as we may + /* with opt_dry we can't just return TRUE; as we may * need to suck in the file's content - which is thrown * away in that case */ @@ -212,7 +212,7 @@ mk_reg(FILE *in, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) msgd(__func__, __LINE__, _("Failed to open file `%s\': %s"), e->f_name, strerror(errno)); ok = FALSE; } - } + } /* we need to read the input to not upset * the flow into rdup-up, but we are not @@ -238,7 +238,7 @@ mk_reg(FILE *in, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) } g_free(buf); if (ok && out) - fclose(out); + fclose(out); if (ok && !opt_dry) mk_meta(e, uidhash, gidhash); @@ -251,7 +251,7 @@ mk_reg(FILE *in, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) } static gboolean -mk_dir(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) +mk_dir(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { struct stat *s; struct stat st; @@ -280,7 +280,7 @@ mk_dir(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) msgd(__func__, __LINE__, _("EACCES for `%s\'"), parent); #endif /* DEBUG */ s = dir_write(parent); - if (!s) + if (!s) msgd(__func__, __LINE__, _("Failed to make parent writable")); if (mkdir(e->f_name, e->f_mode) == -1) { @@ -303,20 +303,20 @@ mk_dir(struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) /* make (or delete) an object in the filesystem */ gboolean -mk_obj(FILE *in, char *p, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) +mk_obj(FILE *in, char *p, struct rdup *e, GHashTable *uidhash, GHashTable *gidhash) { if (opt_verbose == 1 && e->f_name) { - if (S_ISLNK(e->f_mode) || e->f_lnk) + if (S_ISLNK(e->f_mode) || e->f_lnk) fprintf(stdout, "%s -> %s\n", e->f_name, e->f_target); - else + else fprintf(stdout, "%s\n", e->f_name); } - if (opt_table) + if (opt_table) rdup_write_table(e, stdout); - + if (opt_verbose == 2 && e->f_name) - fprintf(stdout, "%c %d %d %s\n", + fprintf(stdout, "%c %d %d %s\n", e->plusmin == PLUS ? '+' : '-', e->f_uid, e->f_gid, e->f_name); @@ -344,7 +344,7 @@ mk_obj(FILE *in, char *p, struct rdup *e, GHashTable *uidhash, GHashTable *gidha return mk_dir(e, uidhash, gidhash); /* First sym and hardlinks and then regular files */ - if (S_ISLNK(e->f_mode) || e->f_lnk) + if (S_ISLNK(e->f_mode) || e->f_lnk) return mk_link(e, p, uidhash, gidhash); if (S_ISBLK(e->f_mode) || S_ISCHR(e->f_mode)) @@ -369,7 +369,7 @@ mk_hlink(GSList *h) if (opt_dry) return TRUE; - for (p = g_slist_nth(h, 0); p; p = p->next) { + for (p = g_slist_nth(h, 0); p; p = p->next) { e = (struct rdup *)p->data; if (link(e->f_target, e->f_name) == -1) { if (errno == EACCES) { diff --git a/getdelim.c b/getdelim.c index ca1cdbed..4af53bbc 100644 --- a/getdelim.c +++ b/getdelim.c @@ -4,7 +4,7 @@ extern int sig; -/* copied from xine-devel, same license applies +/* copied from xine-devel, same license applies * slightly modified to fit my needs */ ssize_t diff --git a/gfunc.c b/gfunc.c index fc1f19e4..f080c51d 100644 --- a/gfunc.c +++ b/gfunc.c @@ -33,7 +33,7 @@ int sha1_stream(FILE *stream, void *digest); * calculates a files sha1 sum */ static gboolean -sha1(FILE *fp, char *filename) +sha1(FILE *fp, char *filename) { unsigned char digest[SHA1_DIGEST_SIZE]; gint i; @@ -170,7 +170,7 @@ entry_cat_data(FILE *fp, struct rdup *e) if (!cat(fp, e->f_name)) exit(EXIT_FAILURE); - if (opt_atime) + if (opt_atime) if (utime(e->f_name, &ut) == -1) msg(_("Failed to reset atime: '%s\': %s"), e->f_name, strerror(errno)); return; @@ -239,7 +239,7 @@ entry_print_data(FILE *out, char n, struct rdup *e) if (S_ISLNK(e->f_mode) || e->f_lnk == 1) { fprintf(stderr, "[%s] [%s]\n", e->f_name, e->f_target); fprintf(stderr, "%d %d\n", (int)e->f_name_size, strlen(e->f_target)); - fprintf(out, "%ld", (unsigned long)e->f_name_size + 4 + + fprintf(out, "%ld", (unsigned long)e->f_name_size + 4 + (unsigned long)strlen(e->f_target)); } else #endif @@ -250,7 +250,7 @@ entry_print_data(FILE *out, char n, struct rdup *e) fprintf(out, "%ld", (unsigned long)e->f_uid); break; case 'U': - if (!e->f_user) + if (!e->f_user) fprintf(out, "-"); else fprintf(out, "%s", e->f_user); @@ -259,7 +259,7 @@ entry_print_data(FILE *out, char n, struct rdup *e) fprintf(out, "%ld", (unsigned long)e->f_gid); break; case 'G': - if (!e->f_group) + if (!e->f_group) fprintf(out, "-"); else fprintf(out, "%s", e->f_group); @@ -345,7 +345,7 @@ entry_print(FILE *out, guint pm, struct rdup *e, char *fmt) fputs("** ", stderr); fputc(pm == PLUS ? '+' : '-', stderr); fprintf(stderr, " %s", e->f_name); - if (S_ISLNK(e->f_mode) || e->f_lnk == 1) + if (S_ISLNK(e->f_mode) || e->f_lnk == 1) fprintf(stderr, " -> %s\n", e->f_target); else fputs("\n", stderr); @@ -428,10 +428,10 @@ gfunc_write(gpointer data, gpointer value, gpointer fp) if (S_ISDIR(e->f_mode)) /* the same as in the normal output */ file_size = 0; - fprintf((FILE*) fp, "%5ld %ld %ld %c %ld %ld %ld %ld %s", (long int)e->f_mode, - (long int)e->f_dev, - (long int)e->f_ino, linktype, - (long int)e->f_uid, + fprintf((FILE*) fp, "%5ld %ld %ld %c %ld %ld %ld %ld %s", (long int)e->f_mode, + (long int)e->f_dev, + (long int)e->f_ino, linktype, + (long int)e->f_uid, (long int)e->f_gid, (long int)name_size, (long int)file_size, n); fputc('\n', (FILE*)fp); @@ -451,7 +451,7 @@ gfunc_backup(gpointer data, gpointer value, signal_abort(sig); /* .nobackup seen, don't print it */ - if (value == NO_PRINT) + if (value == NO_PRINT) return FALSE; if (S_ISDIR(((struct rdup*)data)->f_mode)) { @@ -470,9 +470,9 @@ gfunc_backup(gpointer data, gpointer value, if (((struct rdup*)data)->f_ctime >= opt_timestamp) { entry_print(stdout, PLUS, (struct rdup*)data, opt_format); #if DEBUG - msgd(__func__, __LINE__,"%s %ld >= %ld diff %ld\n", + msgd(__func__, __LINE__,"%s %ld >= %ld diff %ld\n", ((struct rdup*)data)->f_name, - (long int)((struct rdup*)data)->f_ctime, + (long int)((struct rdup*)data)->f_ctime, (long int)opt_timestamp, (long int)opt_timestamp - (long int)((struct rdup*)data)->f_ctime); @@ -488,7 +488,7 @@ gfunc_backup(gpointer data, gpointer value, * write out the list of removed items */ gboolean -gfunc_remove(gpointer data, gpointer value, +gfunc_remove(gpointer data, gpointer value, __attribute__((unused)) gpointer usr) { @@ -508,14 +508,14 @@ gfunc_remove(gpointer data, gpointer value, * Print out the list of new item */ gboolean -gfunc_new(gpointer data, __attribute__((unused)) gpointer value, +gfunc_new(gpointer data, __attribute__((unused)) gpointer value, __attribute__((unused)) gpointer usr) { if (sig != 0) signal_abort(sig); /* it is perfectly possibly to have these here */ - if (value == NO_PRINT) + if (value == NO_PRINT) return FALSE; if (opt_size != 0 && S_ISREG(((struct rdup*)data)->f_mode) && @@ -547,16 +547,16 @@ gfunc_equal(gconstpointer a, gconstpointer b) if (e == 0) { if (ae->f_dev != be->f_dev) return -1; - if (ae->f_ino != be->f_ino) + if (ae->f_ino != be->f_ino) return -2; /* if we are looking at a directory and only the mode has changed * don't let rdup remove the entire directory */ - if (S_ISDIR(ae->f_mode) && S_ISDIR(be->f_mode) && + if (S_ISDIR(ae->f_mode) && S_ISDIR(be->f_mode) && ((ae->f_mode & ~S_IFMT) != (be->f_mode & ~S_IFMT)) ) return 0; - if (ae->f_mode != be->f_mode) + if (ae->f_mode != be->f_mode) return -3; } return e; @@ -572,7 +572,7 @@ gfunc_remove_path(gpointer data, gpointer __attribute__((unused)) value, gpointe signal_abort(sig); if (strncmp(((struct rdup*)data)->f_name, - ((struct remove_path *)r)->path, + ((struct remove_path *)r)->path, ((struct remove_path *)r)->len) == 0) { /* don't remove the directory itself */ @@ -603,7 +603,7 @@ gfunc_subtract(gpointer data, gpointer value, gpointer diff) v = g_tree_lookup((GTree*)((struct subtract*)diff)->b, data); - if (!v) + if (!v) g_tree_insert(((struct subtract*)diff)->d, data, value); return FALSE; @@ -620,7 +620,7 @@ gfunc_regexp(GSList *l, char *n, size_t len) pcre *P; int ovector[REG_VECTOR]; - for (k = g_slist_nth(l, 0); k; k = k->next) { + for (k = g_slist_nth(l, 0); k; k = k->next) { if (sig != 0) signal_abort(sig); @@ -638,8 +638,8 @@ gfunc_regexp(GSList *l, char *n, size_t len) * put an element of the tree in a double linked list */ gboolean -gfunc_tree2list(gpointer data, gpointer value, - __attribute__((unused)) gpointer l) +gfunc_tree2list(gpointer data, gpointer value, + __attribute__((unused)) gpointer l) { if (sig != 0) signal_abort(sig); diff --git a/link.c b/link.c index 3af5d53f..209071d1 100644 --- a/link.c +++ b/link.c @@ -32,7 +32,7 @@ hlink(GHashTable *t, struct rdup *e) gchar * slink(struct rdup *e) { - char buf[BUFSIZE + 1]; + char buf[BUFSIZE + 1]; ssize_t i; if ((i = readlink(e->f_name, buf, BUFSIZE)) == -1) { diff --git a/mkpath.c b/mkpath.c index 994cdf72..432b4f5b 100644 --- a/mkpath.c +++ b/mkpath.c @@ -1,5 +1,5 @@ /* Function with behaviour like `mkdir -p' */ -/* From: http://niallohiggins.com/2009/01/08/mkpath-mkdir-p-alike-in-c-for-unix/ +/* From: http://niallohiggins.com/2009/01/08/mkpath-mkdir-p-alike-in-c-for-unix/ * with some tweaks * libglib'i'fied by Miek Gieben */ @@ -25,12 +25,12 @@ mkpath(const char *s, mode_t mode) msgd(__func__, __LINE__, _("Failed or exists '%s\': %s"), up, strerror(errno)); goto out; } - + if ((mkdir(path, mode) == -1) && (errno != EEXIST)) msgd(__func__, __LINE__, _("Failed to create directory '%s\': %s"), path, strerror(errno)); else rv = 0; - + out: if (up) g_free(up); if (q) g_free(q); diff --git a/names.c b/names.c index 2e9d2c67..f7c224bb 100644 --- a/names.c +++ b/names.c @@ -1,4 +1,4 @@ -/* +/* * lookup the user/group names associated with the uid/gid * Use hashes to speed things up */ @@ -25,7 +25,7 @@ lookup_uid(GHashTable *u, gchar *user, uid_t uid_given) return 0; uid_tmp = (uid_t*)g_hash_table_lookup(u, user); - if (uid_tmp) + if (uid_tmp) return *uid_tmp; p = getpwnam(user); @@ -78,7 +78,7 @@ lookup_user(GHashTable *u, uid_t uid) struct passwd *p; n = (gchar *)g_hash_table_lookup(u, (gpointer)&uid); - if (n) + if (n) return n; /* if nothing found also add to hash? */ @@ -102,7 +102,7 @@ lookup_group(GHashTable *g, gid_t gid) struct group *p; n = (gchar *)g_hash_table_lookup(g, (gpointer)&gid); - if (n) + if (n) return n; p = getgrgid(gid); diff --git a/protocol.c b/protocol.c index 0c38b8bf..5ea87923 100644 --- a/protocol.c +++ b/protocol.c @@ -1,4 +1,4 @@ -/* +/* * A simple protocol for rdup, if you even want * to call it a protocol * @@ -13,7 +13,7 @@ * * 01BLOCK00004 * <4 bytes of the file>01BLOCK00000 - * + * * A stop block is a block with length zero 01BLOCK00000, this * comes after each file. */ @@ -39,12 +39,12 @@ void signal_abort(int); * output a block header */ gint -block_out_header(FILE *f, size_t size, int fp) +block_out_header(FILE *f, size_t size, int fp) { char *p; - p = g_strdup_printf("%c%c%s%05d\n", PROTO_VERSION_MAJOR, + p = g_strdup_printf("%c%c%s%05d\n", PROTO_VERSION_MAJOR, PROTO_VERSION_MINOR, PROTO_BLOCK,(int)size); - if (sig != 0) + if (sig != 0) signal_abort(sig); if (f) { if (fwrite(p, sizeof(char), strlen(p), f) != strlen(p)) @@ -62,9 +62,9 @@ block_out_header(FILE *f, size_t size, int fp) * output a block */ gint -block_out(FILE *f, size_t size, char *buf, int fp) +block_out(FILE *f, size_t size, char *buf, int fp) { - if (sig != 0) + if (sig != 0) signal_abort(sig); if (f) { if (fwrite(buf, sizeof(char), size, f) != size) @@ -81,9 +81,9 @@ block_out(FILE *f, size_t size, char *buf, int fp) * read a block from f */ gint -block_in(FILE *f, size_t size, char *buf) +block_in(FILE *f, size_t size, char *buf) { - if (sig != 0) + if (sig != 0) signal_abort(sig); if (fread(buf, sizeof(char), size, f) != size) { /* read less then expected */ @@ -95,11 +95,11 @@ block_in(FILE *f, size_t size, char *buf) /** * parse a block header: 01BLOCK08192 * return the number of bytes to read - * 00000 signals the end (no more bytes to read + * 00000 signals the end (no more bytes to read * -1 for parse errors */ size_t -block_in_header(FILE *f) +block_in_header(FILE *f) { /* we are expecting a block header: * 2 pos version; the word block; 5 digit number; newline @@ -143,15 +143,15 @@ block_in_header(FILE *f) } /* the bytes */ - c[0] = fgetc(f); + c[0] = fgetc(f); if (sig != 0) signal_abort(sig); - c[1] = fgetc(f); + c[1] = fgetc(f); if (sig != 0) signal_abort(sig); - c[2] = fgetc(f); + c[2] = fgetc(f); if (sig != 0) signal_abort(sig); - c[3] = fgetc(f); + c[3] = fgetc(f); if (sig != 0) signal_abort(sig); - c[4] = fgetc(f); + c[4] = fgetc(f); if (sig != 0) signal_abort(sig); c[5] = fgetc(f); /* \n */ if (sig != 0) signal_abort(sig); diff --git a/rdup-tr.c b/rdup-tr.c index 1a9b4cf1..d0ab1c0d 100644 --- a/rdup-tr.c +++ b/rdup-tr.c @@ -1,8 +1,8 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * See LICENSE for the license * rdup-tr -- rdup translate, transform an - * rdup filelist to an tar/cpio archive with + * rdup filelist to an tar/cpio archive with * per file compression and/or encryption or whatever */ @@ -40,7 +40,7 @@ void entry_free(struct rdup *f); /* encrypt an rdup_entry (just the path of course) */ static struct rdup * -crypt_entry(struct rdup *e, GHashTable *tr) +crypt_entry(struct rdup *e, GHashTable *tr) { gchar *crypt, *dest; if (! (crypt = crypt_path(aes_ctx,e->f_name, tr))) { @@ -62,7 +62,7 @@ crypt_entry(struct rdup *e, GHashTable *tr) /* decrypt an rdup_entry */ static struct rdup * -decrypt_entry(struct rdup *e, GHashTable *tr) +decrypt_entry(struct rdup *e, GHashTable *tr) { gchar *plain, *dest; @@ -88,7 +88,7 @@ decrypt_entry(struct rdup *e, GHashTable *tr) * the childeren, collect the output from the last * child and create the archive on stdout */ -static void +static void stdin2archive(void) { char *buf, *fbuf, *readbuf, *n, *pathbuf; @@ -148,10 +148,10 @@ stdin2archive(void) while ((rdup_getdelim(&buf, &i, delim, stdin)) != -1) { line++; n = strrchr(buf, '\n'); - if (n) + if (n) *n = '\0'; - if (sig != 0) + if (sig != 0) signal_abort(sig); if (!(rdup_entry = parse_entry(buf, line))) { @@ -166,12 +166,12 @@ stdin2archive(void) msg(_("Reported name size (%zd) does not match actual name size (%zd)"), rdup_entry->f_name_size, pathsize); exit(EXIT_FAILURE); - } + } pathbuf[pathsize] = '\0'; if (pathbuf[0] != '/') { msg(_("Pathname does not start with /: `%s\'"), pathbuf); exit(EXIT_FAILURE); - } + } rdup_entry->f_name = pathbuf; @@ -180,7 +180,7 @@ stdin2archive(void) // filesize is spot where to cut and set new size rdup_entry->f_name[rdup_entry->f_size] = '\0'; rdup_entry->f_name_size = strlen(rdup_entry->f_name); - rdup_entry->f_target = rdup_entry->f_name + + rdup_entry->f_target = rdup_entry->f_name + rdup_entry->f_size + 4; } else { rdup_entry->f_target = NULL; @@ -198,13 +198,13 @@ stdin2archive(void) signal_abort(sig); rdup_entry = rdup_entry; -#ifdef HAVE_LIBNETTLE - if (opt_crypt_key) +#ifdef HAVE_LIBNETTLE + if (opt_crypt_key) rdup_entry = crypt_entry(rdup_entry, trhash); if (opt_decrypt_key) rdup_entry = decrypt_entry(rdup_entry, trhash); - if (!rdup_entry) + if (!rdup_entry) exit(EXIT_FAILURE); /* encryption problem */ #endif /* HAVE_LIBNETTLE */ @@ -221,7 +221,7 @@ stdin2archive(void) if (rdup_entry->f_lnk == 1) { /* hardlinks must come last */ hlinks = g_slist_append(hlinks, entry_dup(rdup_entry)); - continue; + continue; } s = stat_from_rdup(rdup_entry); @@ -234,26 +234,26 @@ stdin2archive(void) } /* size may be changed - we don't care anymore */ - if (opt_output != O_RDUP) + if (opt_output != O_RDUP) archive_write_header(archive, entry); else (void)rdup_write_header(rdup_entry); /* bail out for non regular files */ if (! S_ISREG(rdup_entry->f_mode) || rdup_entry->f_lnk == 1) - goto not_s_isreg; + goto not_s_isreg; /* regular files */ while ((bytes = block_in_header(stdin)) > 0) { if (block_in(stdin, bytes, fbuf) == -1) { msg(_("Failure to read from stdin: %s"), strerror(errno)); - exit(EXIT_FAILURE); - } + exit(EXIT_FAILURE); + } - if (sig != 0) + if (sig != 0) signal_abort(sig); - if (opt_output == O_RDUP) + if (opt_output == O_RDUP) (void)rdup_write_data(rdup_entry, fbuf, bytes); else archive_write_data(archive, fbuf, bytes); @@ -263,7 +263,7 @@ stdin2archive(void) if (opt_output == O_RDUP) block_out_header(NULL, 0, 1); -not_s_isreg: +not_s_isreg: if (opt_output != O_RDUP) archive_entry_free(entry); diff --git a/rdup-up.c b/rdup-up.c index a307b5fc..29f35e04 100644 --- a/rdup-up.c +++ b/rdup-up.c @@ -1,7 +1,7 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * See LICENSE for the license - * rdup-up -- update an directory tree with + * rdup-up -- update an directory tree with * and rdup archive */ @@ -53,7 +53,7 @@ update(char *path) while ((rdup_getdelim(&buf, &i, delim, stdin)) != -1) { line++; n = strrchr(buf, '\n'); - if (n) + if (n) *n = '\0'; if (!(rdup_entry = parse_entry(buf, line))) { @@ -81,7 +81,7 @@ update(char *path) if (S_ISLNK(rdup_entry->f_mode) || rdup_entry->f_lnk) { // filesize is spot where to cut rdup_entry->f_name[rdup_entry->f_size] = '\0'; - rdup_entry->f_target = rdup_entry->f_name + + rdup_entry->f_target = rdup_entry->f_name + rdup_entry->f_size + 4; } else { rdup_entry->f_target = NULL; @@ -91,7 +91,7 @@ update(char *path) if (opt_strip) strippath(rdup_entry); - if (opt_path_strip) + if (opt_path_strip) strippathname(rdup_entry); if (!rdup_entry->f_name) @@ -232,7 +232,7 @@ main(int argc, char **argv) msg(_("Destination directory is required")); exit(EXIT_FAILURE); } - if (!g_path_is_absolute(argv[0])) + if (!g_path_is_absolute(argv[0])) path = abspath(g_strdup_printf("%s/%s", pwd, argv[0])); else path = abspath(argv[0]); diff --git a/rdup.c b/rdup.c index 3ed99141..2459bf43 100644 --- a/rdup.c +++ b/rdup.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2005 - 2010 Miek Gieben * See LICENSE for the license */ @@ -46,7 +46,7 @@ g_tree_subtract(GTree *a, GTree *b) diff = g_tree_new(gfunc_equal); s.d = diff; s.b = b; - /* everything in a, but NOT in b + /* everything in a, but NOT in b * diff gets filled inside this function */ g_tree_foreach(a, gfunc_subtract, (gpointer)&s); return diff; @@ -88,11 +88,11 @@ g_tree_read_file(FILE *fp) } /* comment */ - if (buf[0] == '#') + if (buf[0] == '#') continue; - if (s < LIST_MINSIZE) - CORRUPT("Corrupt entry at line: %zd, line to short"); + if (s < LIST_MINSIZE) + CORRUPT("Corrupt entry at line: %zd, line to short"); n = strrchr(buf, '\n'); @@ -119,7 +119,7 @@ g_tree_read_file(FILE *fp) /* the inode */ q = p + 1; p = strchr(p + 1, ' '); - if (!p) + if (!p) CORRUPT("Corrupt entry at line: %zd, no space found"); *p = '\0'; @@ -130,7 +130,7 @@ g_tree_read_file(FILE *fp) /* hardlink/link or anything else: h/l or * */ q = p + 1; p = strchr(p + 1, ' '); - if (!p) + if (!p) CORRUPT("Corrupt entry at line: %zd, no link information found"); linktype = *q; @@ -158,7 +158,7 @@ g_tree_read_file(FILE *fp) } *p = '\0'; f_name_size = (size_t)atoi(q); - if (f_name_size == 0) + if (f_name_size == 0) CORRUPT("Pathname lenght can not be zero at line: %zd"); /* filesize */ @@ -169,7 +169,7 @@ g_tree_read_file(FILE *fp) *p = '\0'; f_size = (size_t)atoi(q); - + /* with getdelim we read the delimeter too kill it here */ str_len = strlen(p + 1); if (str_len == 1) @@ -179,7 +179,7 @@ g_tree_read_file(FILE *fp) if (str_len != f_name_size) { msg(_("Corrupt entry at line: %zd, length `%zd\' does not match `%zd\'"), l, str_len, f_name_size); - l++; + l++; continue; } @@ -310,14 +310,14 @@ main(int argc, char **argv) opt_format = optarg; break; case 'E': - if (!regexp_init(optarg)) + if (!regexp_init(optarg)) exit(EXIT_FAILURE); break; case 'a': opt_atime = TRUE; /* when atime is true, every file is touched during the - * backup (the c_time changes). To make rdup not see these - * files as new in the backup, we must set the timestamp + * backup (the c_time changes). To make rdup not see these + * files as new in the backup, we must set the timestamp * file with a timestamp AFTER the backup. * If we do this we will not see file the are changed * DURING the backup... @@ -340,7 +340,7 @@ main(int argc, char **argv) case 'n': opt_nobackup = FALSE; break; - case 'N': + case 'N': opt_timestamp = timestamp(optarg, TRUE); stamp = optarg; break; @@ -367,18 +367,18 @@ main(int argc, char **argv) if (i > MAX_CHILD_OPT) { msg(_("Only %d extra args per child allowed"), MAX_CHILD_OPT); exit(EXIT_FAILURE); - } + } *r = '\0'; args[i] = g_strdup(q); q = r + 1; - } + } args[i] = g_strdup(q); args[i + 1] = NULL; - } + } child = g_slist_append(child, args); break; case 'v': - opt_verbose++; + opt_verbose++; if (opt_verbose > 2) { opt_verbose = 2; } @@ -438,7 +438,7 @@ main(int argc, char **argv) } for (i = 1; i < argc; i++) { - if (!g_path_is_absolute(argv[i])) + if (!g_path_is_absolute(argv[i])) path = abspath(g_strdup_printf("%s/%s", pwd, argv[i])); else path = abspath(argv[i]); @@ -482,9 +482,9 @@ main(int argc, char **argv) list_remove = reverse(remove); list_changed = reverse(changed); list_new = reverse(new); - g_list_foreach(list_remove, gfunc_remove_list, NULL); - g_list_foreach(list_changed, gfunc_backup_list, NULL); - g_list_foreach(list_new, gfunc_new_list, NULL); + g_list_foreach(list_remove, gfunc_remove_list, NULL); + g_list_foreach(list_changed, gfunc_backup_list, NULL); + g_list_foreach(list_new, gfunc_new_list, NULL); } else { g_tree_foreach(remove, gfunc_remove, NULL); g_tree_foreach(changed, gfunc_backup, NULL); @@ -497,7 +497,7 @@ main(int argc, char **argv) msg(_("Could not write filelist `%s\': %s"), argv[0], strerror(errno)); } else { /* write temporary file, add little comment */ - fprintf(fplist, + fprintf(fplist, "# mode dev inode linktype uid gid pathlen filesize path\n"); g_tree_foreach(backup, gfunc_write, fplist); fclose(fplist); diff --git a/regexp.c b/regexp.c index 800bafd0..2d7ddb26 100644 --- a/regexp.c +++ b/regexp.c @@ -15,7 +15,7 @@ GSList *pregex_list = NULL; * in a linked list */ gboolean -regexp_init(char *file) +regexp_init(char *file) { FILE *fp; char *buf; @@ -40,7 +40,7 @@ regexp_init(char *file) l = 1; while ((j = rdup_getdelim(&buf, &s, delim, fp)) != -1) { - if (buf[0] == '#' || buf[0] == '\n') + if (buf[0] == '#' || buf[0] == '\n') continue; /* buf[j - 1] holds the delimeter */ @@ -49,7 +49,7 @@ regexp_init(char *file) if ((P = pcre_compile(buf, 0, &errbuf, &erroff, NULL)) == NULL) { /* error */ fclose(fp); - msg(_("Corrupt regular expression line: %zd, column %d: %s"), l, erroff, errbuf); + msg(_("Corrupt regular expression line: %zd, column %d: %s"), l, erroff, errbuf); g_free(buf); return FALSE; } else { diff --git a/reverse.c b/reverse.c index 5636cac3..b85cc999 100644 --- a/reverse.c +++ b/reverse.c @@ -12,7 +12,7 @@ GList *list; /* Walk each element and put it in a list */ GList * -reverse(GTree *g) +reverse(GTree *g) { list = NULL; g_tree_foreach(g, gfunc_tree2list, NULL); @@ -25,8 +25,8 @@ reverse(GTree *g) * skip all NO_PRINT entries, hence to harcoded * used of VALUE here. */ -void -gfunc_new_list(gpointer data, gpointer userdata) +void +gfunc_new_list(gpointer data, gpointer userdata) { (void)gfunc_new(data, VALUE, userdata); } diff --git a/rm.c b/rm.c index 5d4f7a92..3adbc51a 100644 --- a/rm.c +++ b/rm.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2009,2010 Miek Gieben * See LICENSE for the license * rm.c remove an fs object (recursively) @@ -106,7 +106,7 @@ rm(gchar *p) p, strerror(errno)); chmod(p, st.st_mode); /* is this usefull then? */ return FALSE; - } + } return TRUE; } diff --git a/sha1.c b/sha1.c index 27ad58f8..01f1140b 100644 --- a/sha1.c +++ b/sha1.c @@ -35,5 +35,5 @@ sha1_stream(FILE *f, unsigned char *digest) sha1_digest(&ctx, SHA1_DIGEST_SIZE, digest); #endif /* HAVE_LIBNETTLE */ - return 0; + return 0; } diff --git a/signal.c b/signal.c index 914ef717..d242edb0 100644 --- a/signal.c +++ b/signal.c @@ -1,4 +1,4 @@ -/* +/* * Copyright (c) 2005-2010 Miek Gieben * See LICENSE for the license */ diff --git a/strippath.c b/strippath.c index 1c5b3de9..7096de50 100644 --- a/strippath.c +++ b/strippath.c @@ -2,7 +2,7 @@ /* strip n components from pathname * sets path to NULL when the path didn't contain enough - * components to begin with + * components to begin with * * Symlinks are handled as follows: * with path1 -> path2, only path1 is modified (shortened) @@ -19,7 +19,7 @@ extern gchar *opt_path_strip; extern guint opt_path_strip_len; /* Count the number of slashes in a string (=path) */ -static guint pathlabel(struct rdup *e) +static guint pathlabel(struct rdup *e) { gint i, j = 0; @@ -91,7 +91,7 @@ strippathname(struct rdup *e) } /* } */ - if (g_str_has_prefix(e->f_name, opt_path_strip) == FALSE) + if (g_str_has_prefix(e->f_name, opt_path_strip) == FALSE) return; len = strlen(opt_path_strip) - 1; /* -1: discard the trailing slash */ diff --git a/xattr.c b/xattr.c index 2b661ca2..78e8cda8 100644 --- a/xattr.c +++ b/xattr.c @@ -29,7 +29,7 @@ read_attr_uid(__attribute__((unused)) x = (uid_t)atoi(buf); buf[r - 1] = '\0'; if (x > R_MAX_ID) { - msg(_("Too large uid `%zd\' for `%s\', truncating"), (size_t)x, + msg(_("Too large uid `%zd\' for `%s\', truncating"), (size_t)x, path); return R_MAX_ID; } @@ -81,7 +81,7 @@ read_attr_gid(__attribute__((unused)) buf[r - 1] = '\0'; x = (gid_t)atoi(buf); if (x > R_MAX_ID) { - msg(_("Too large gid `%zd\' for `%s\', truncating"), (size_t)x, + msg(_("Too large gid `%zd\' for `%s\', truncating"), (size_t)x, path); return R_MAX_ID; }