diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-21 13:30:51 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-21 13:31:26 +0200 |
commit | 1213cf065e9b3a5fb45d00276b3d168462838c17 (patch) | |
tree | 8d8f3cb7617465139f0051c10ef80fa9c2c91369 /src | |
parent | 5bfe69d55cff8940fd3a84ff479e6e8308b164f4 (diff) | |
download | wydawca-1213cf065e9b3a5fb45d00276b3d168462838c17.tar.gz wydawca-1213cf065e9b3a5fb45d00276b3d168462838c17.tar.bz2 |
Remove trailing whitespace
Diffstat (limited to 'src')
-rw-r--r-- | src/builtin.c | 22 | ||||
-rw-r--r-- | src/cmdline.opt | 2 | ||||
-rw-r--r-- | src/config.c | 94 | ||||
-rw-r--r-- | src/directive.c | 36 | ||||
-rw-r--r-- | src/diskio.c | 76 | ||||
-rw-r--r-- | src/exec.c | 12 | ||||
-rw-r--r-- | src/getopt.m4 | 60 | ||||
-rw-r--r-- | src/gpg.c | 34 | ||||
-rw-r--r-- | src/interval.c | 8 | ||||
-rw-r--r-- | src/mail.c | 30 | ||||
-rw-r--r-- | src/method.c | 22 | ||||
-rw-r--r-- | src/process.c | 18 | ||||
-rw-r--r-- | src/sql.c | 14 | ||||
-rw-r--r-- | src/triplet.c | 48 | ||||
-rw-r--r-- | src/verify.c | 22 | ||||
-rw-r--r-- | src/wydawca.c | 46 | ||||
-rw-r--r-- | src/wydawca.h | 18 |
17 files changed, 281 insertions, 281 deletions
diff --git a/src/builtin.c b/src/builtin.c index 7d2c276..761a01a 100644 --- a/src/builtin.c +++ b/src/builtin.c @@ -48,7 +48,7 @@ builtin_open (struct access_method *meth) #define RF_BASIC 0x2 #define STRMATCH(s, p, len) \ - (len == sizeof(s) - 1 && memcmp (s, p, sizeof(s) - 1) == 0) + (len == sizeof(s) - 1 && memcmp (s, p, sizeof(s) - 1) == 0) typedef int (*strcmp_fn) (const char *, const char *, int flags); @@ -89,7 +89,7 @@ cmp_regex (const char *pat, const char *str, int flags) rc = regexec (®ex, str, 0, NULL, 0); regfree (®ex); return rc == 0; -} +} int parse_cmp_type (const char *pat, strcmp_fn *cmpfn, int *rf) @@ -97,7 +97,7 @@ parse_cmp_type (const char *pat, strcmp_fn *cmpfn, int *rf) size_t len = strcspn (pat, ","); int flags = 0; int cmp; - + if (STRMATCH ("exact", pat, len)) cmp = CMP_EXACT; else if (STRMATCH ("fnmatch", pat, len)) @@ -117,11 +117,11 @@ parse_cmp_type (const char *pat, strcmp_fn *cmpfn, int *rf) case 'i': flags |= RF_ICASE; break; - + case 'b': flags |= RF_BASIC; break; - + default: logmsg (LOG_NOTICE, "unrecognized comparison flag: %c", *pat); } @@ -174,7 +174,7 @@ builtin_run (struct access_method *meth, void *handle, const char *req) strcmp_fn cmpfn = cmp_exact; struct builtin_data_storage *bds; int ncol = default_ncol[meth->id]; - + if (meth->parmc == 0) { meth->nrow = meth->ncol = 0; @@ -182,12 +182,12 @@ builtin_run (struct access_method *meth, void *handle, const char *req) } obstack_init (&stk); - + for (i = 0; i < meth->parmc; i++) { char *pat = meth->parmv[i]; char *val; - + if (pat[0] == '/') { pat++; @@ -197,7 +197,7 @@ builtin_run (struct access_method *meth, void *handle, const char *req) if (i + ncol >= meth->parmc) break; - + if (cmpfn (pat, req, flags)) { size_t j; @@ -239,9 +239,9 @@ builtin_run (struct access_method *meth, void *handle, const char *req) } rc = 0; } - + meth->storage = bds; - + return rc; } diff --git a/src/cmdline.opt b/src/cmdline.opt index 5b3ed22..cb269f6 100644 --- a/src/cmdline.opt +++ b/src/cmdline.opt @@ -80,7 +80,7 @@ OPTION(,E,, [<preprocess config and exit>]) BEGIN preprocess_only = 1; -END +END OPTION(dump-grammar-trace,,, [<dump configuration grammar traces>]) diff --git a/src/config.c b/src/config.c index 61cf324..c22074f 100644 --- a/src/config.c +++ b/src/config.c @@ -38,13 +38,13 @@ static struct notification *default_notification = NULL; /home/user/../smith --> /home/smith /home/user/../.. --> / ../file --> NULL -*/ +*/ char * safe_file_name (char *file_name) { int len; char *p; - + if (!file_name) return file_name; @@ -99,7 +99,7 @@ safe_file_name (char *file_name) continue; } } - + p++; } @@ -130,7 +130,7 @@ string_to (const char *what, const char *str, gconf_locus_t *locus) { ptrdiff_t x = ARGMATCH (str, args, vals); - + if (x == (ptrdiff_t)-1) { gconf_error (locus, 0, _("unknown %s: %s"), what, str); @@ -250,7 +250,7 @@ get_arg (gconf_locus_t *locus, gconf_value_t *value, unsigned n, int type) } return value; } - + static int cb_mailer (enum gconf_callback_command cmd, @@ -289,7 +289,7 @@ cb_email_address (enum gconf_callback_command cmd, { int rc; mu_address_t addr; - + if (assert_string_arg (locus, cmd, value)) return 1; rc = mu_address_create (&addr, value->v.string); @@ -310,7 +310,7 @@ cb_interval (enum gconf_callback_command cmd, int rc; time_t interval; const char *endp; - + /* FIXME 1: Support arrays */ if (assert_string_arg (locus, cmd, value)) return 1; @@ -333,7 +333,7 @@ cb_absolute_name (enum gconf_callback_command cmd, void *cb_data) { char *word; - + /* FIXME 1: Support arrays */ if (assert_string_arg (locus, cmd, value)) return 1; @@ -355,7 +355,7 @@ cb_set_umask (enum gconf_callback_command cmd, { char *p; mode_t m; - + if (assert_string_arg (locus, cmd, value)) return 1; m = strtoul (value->v.string, &p, 8) & 0777; @@ -408,13 +408,13 @@ parse_single_statmask (gconf_locus_t *locus, const gconf_value_t *val, { const char *arg; ptrdiff_t x; - + if (val->type != GCONF_TYPE_STRING) { gconf_error (locus, 0, _("expected scalar value but found list")); return 1; } - + arg = val->v.string; if (strcmp (arg, "all") == 0) @@ -429,9 +429,9 @@ parse_single_statmask (gconf_locus_t *locus, const gconf_value_t *val, *invert = 0; return 0; } - + x = ARGMATCH (arg, stat_args, stat_types); - + if (x == (ptrdiff_t)-1) { gconf_error (locus, 0, _("unknown statistics type: %s"), arg); @@ -458,11 +458,11 @@ parse_statmask (gconf_locus_t *loc, gconf_value_t *val, unsigned long *pmask) case GCONF_TYPE_STRING: err = parse_single_statmask (loc, val, &mask, &invert); break; - + case GCONF_TYPE_ARRAY: { int i; - + for (i = 0; i < val->v.arg.c; i++) { unsigned long x; @@ -485,7 +485,7 @@ parse_statmask (gconf_locus_t *loc, gconf_value_t *val, unsigned long *pmask) { const gconf_value_t *vp = p; unsigned long x; - + if (parse_single_statmask (loc, vp, &x, &invert)) err = 1; else if (invert) @@ -500,7 +500,7 @@ parse_statmask (gconf_locus_t *loc, gconf_value_t *val, unsigned long *pmask) *pmask = mask; return err; } - + static int cb_statistics (enum gconf_callback_command cmd, gconf_locus_t *locus, @@ -521,7 +521,7 @@ cb_sql_host (enum gconf_callback_command cmd, { struct sqlconn *pconn = varptr; char *p; - + if (assert_string_arg (locus, cmd, value)) return 1; @@ -569,7 +569,7 @@ cb_sql (enum gconf_callback_command cmd, { struct sqlconn *pconn; void **pdata = cb_data; - + switch (cmd) { case gconf_callback_section_begin: if (!value || value->type != GCONF_TYPE_STRING) @@ -594,7 +594,7 @@ cb_sql (enum gconf_callback_command cmd, } return 0; } - + static struct gconf_keyword sql_kw[] = { { "host", N_("host"), N_("Set SQL server hostname or IP address"), gconf_type_string, NULL, 0, cb_sql_host }, @@ -633,7 +633,7 @@ cb_define_message (enum gconf_callback_command cmd, void *cb_data) { const char *ident; - + if (cmd != gconf_callback_set_value) { gconf_error (locus, 0, _("Unexpected block statement")); @@ -661,8 +661,8 @@ cb_define_message (enum gconf_callback_command cmd, register_message_template (ident, value->v.arg.v[1].v.string); return 0; } - - + + static struct gconf_keyword syslog_kw[] = { { "facility", @@ -677,7 +677,7 @@ static struct gconf_keyword syslog_kw[] = { gconf_type_bool, &syslog_include_prio }, { NULL }, }; - + static char const * const backup_args[] = { @@ -741,7 +741,7 @@ cb_backup (enum gconf_callback_command cmd, void *cb_data) { enum backup_type *ptype = varptr; - + if (assert_string_arg (locus, cmd, value)) return 1; *ptype = get_backup_version (locus, NULL, value->v.string); @@ -778,13 +778,13 @@ cb_archive (enum gconf_callback_command cmd, gconf_error (locus, 0, _("expected tag")); return 1; } - + if (value->type != GCONF_TYPE_STRING) { gconf_error (locus, 0, _("expected scalar value but found list")); return 1; } - + if (strcmp (value->v.string, "none") == 0) arch->type = archive_none; else if (strcmp (value->v.string, "tar") == 0) @@ -806,7 +806,7 @@ cb_archive (enum gconf_callback_command cmd, if (arch->type == archive_none) return 0; - + if (arch->name == NULL) { gconf_error (locus, 0, _("at least archive name must be set")); @@ -818,7 +818,7 @@ cb_archive (enum gconf_callback_command cmd, gconf_warning (locus, 0, _("backup type ignored for this archive type")); return 1; } - + return 0; } @@ -842,7 +842,7 @@ cb_event (enum gconf_callback_command cmd, void *cb_data) { enum notification_event *pev = varptr; - + if (assert_string_arg (locus, cmd, value)) return 1; string_to_notification_event (locus, value->v.string, pev); @@ -857,7 +857,7 @@ cb_recipient (enum gconf_callback_command cmd, void *cb_data) { enum notification_target *tgt = varptr; - + if (assert_string_arg (locus, cmd, value)) return 1; string_to_notification_target (locus, value->v.string, tgt); @@ -978,14 +978,14 @@ cb_access_method_params (enum gconf_callback_command cmd, meth->parmc = size; meth->parmv = xcalloc (size + 1, sizeof (meth->parmv[0])); - + for (i = 0; gl_list_iterator_next (&itr, &p, NULL); i++) { const gconf_value_t *vp = p; - + if (assert_string_arg (locus, cmd, vp)) break; - + meth->parmv[i] = xstrdup (vp->v.string); } meth->parmv[i] = NULL; @@ -1011,15 +1011,15 @@ string_to_access_method_id (gconf_locus_t *locus, { static const char *id_str[] = { "verify-user", - "gpg-key", + "gpg-key", "project-owner", "user-data", NULL }; static int id_num[] = { - verify_method, - gpg_key_method, - project_owner_method, + verify_method, + gpg_key_method, + project_owner_method, user_data_method }; ARGMATCH_VERIFY (id_str, id_num); @@ -1032,7 +1032,7 @@ string_to_access_method_id (gconf_locus_t *locus, *idp = res; return rc; } - + static int cb_access_method (enum gconf_callback_command cmd, gconf_locus_t *locus, @@ -1043,7 +1043,7 @@ cb_access_method (enum gconf_callback_command cmd, struct access_method **pmeth, *meth; void **pdata = cb_data; enum access_method_id id; - + switch (cmd) { case gconf_callback_section_begin: if (!value || value->type != GCONF_TYPE_STRING) @@ -1075,7 +1075,7 @@ cb_access_method (enum gconf_callback_command cmd, meth->type = method_none; } break; - + default: /* FIXME: More checks ? */ break; @@ -1122,7 +1122,7 @@ cb_directory (enum gconf_callback_command cmd, struct directory_pair *dpair; void **pdata = cb_data; int ec, i; - + switch (cmd) { case gconf_callback_section_begin: @@ -1175,12 +1175,12 @@ cb_directory (enum gconf_callback_command cmd, if (!dpair->notification) dpair->notification = default_notification; - + register_directory_pair (dpair); free (dpair); *pdata = NULL; break; - + case gconf_callback_set_value: gconf_error (locus, 0, _("invalid use of block statement")); } @@ -1196,7 +1196,7 @@ static struct gconf_keyword wydawca_kw[] = { gconf_type_string, &admin_address, 0, cb_email_address }, { "from-address", N_("email"), N_("Set sender email address"), gconf_type_string, &from_address, 0, cb_email_address }, - + { "enable-sendfile", N_("arg"), N_("Enable or disable sendfile(2) support"), gconf_type_bool, &enable_sendfile }, @@ -1240,7 +1240,7 @@ static struct gconf_keyword wydawca_kw[] = { { "directory", NULL, N_("Define distribution directory"), gconf_type_section, NULL, 0, cb_directory, NULL, directory_kw }, - + { NULL } }; @@ -1258,7 +1258,7 @@ void config_init() { int i; - + gconf_set_keywords (wydawca_kw); gconf_include_path_setup (DEFAULT_VERSION_INCLUDE_DIR, DEFAULT_INCLUDE_DIR, NULL); diff --git a/src/directive.c b/src/directive.c index ec06f15..d99f65b 100644 --- a/src/directive.c +++ b/src/directive.c @@ -28,12 +28,12 @@ directive_parse (struct file_triplet *trp) if (debug_level > 2) logmsg (LOG_DEBUG, "%s: parsing directive blurb: %s", trp->file[file_directive].name, trp->blurb); - + dcount = 0; for (p = trp->blurb; *p; p++) if (*p == '\n') dcount++; - + trp->directive = xcalloc (dcount + 1, sizeof trp->directive[0]); p = trp->blurb; for (i = j = 0; i < dcount; i++) @@ -105,7 +105,7 @@ _directive_seq_get (int n, struct file_triplet *trp, if (trp->directive[n] == NULL) return 0; - + p = strchr (trp->directive[n], ':'); len = p - trp->directive[n]; if (len + 1 > trp->tmpsize) @@ -170,7 +170,7 @@ directive_version_in_range_p (struct file_triplet *trp, { const char *val; unsigned version; - + if (directive_get_value (trp, "version", &val)) { logmsg (LOG_ERR, "%s: missing `version' directive", @@ -187,7 +187,7 @@ directive_version_in_range_p (struct file_triplet *trp, if (from <= version && version <= to) return 1; - + logmsg (LOG_ERR, "%s: version %s is not in the allowed range", trp->file[file_directive].name, val); return 0; @@ -239,7 +239,7 @@ verify_directive_format (struct file_triplet *trp) { int n, dnum; const char *key; - + if (!directive_version_in_range_p (trp, MIN_DIRECTIVE_VERSION, MAX_DIRECTIVE_VERSION)) return 1; @@ -277,10 +277,10 @@ verify_directive_format (struct file_triplet *trp) logmsg (LOG_ERR, "%s:%d: unknown directive `%s'", trp->file[file_directive].name, n, key); return 1; - } + } } } - + if (trp->file[file_dist].name && trp->file[file_signature].name) { const char *filename; @@ -307,7 +307,7 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair) int n; const char *key, *val; char *relative_dir; - + UPDATE_STATS (STAT_COMPLETE_TRIPLETS); for (n = directive_first (trp, &key, &val); n; n = directive_next (trp, n, &key, &val)) @@ -318,22 +318,22 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair) case unknown_dir: /* should not happen */ abort (); - + case comment_dir: logmsg (LOG_NOTICE, "%s: COMMENT: %s", trp->file[file_directive].name, val); break; - + case directory_dir: relative_dir = safe_file_name_alloc (val); if (!relative_dir || relative_dir[0] == '/') { - logmsg (LOG_ERR, "%s: invalid directory: %s", + logmsg (LOG_ERR, "%s: invalid directory: %s", trp->file[file_directive].name, val); return 1; } break; - + case filename_dir: if (verify_detached_signature (trp, dpair) == 0) { @@ -347,11 +347,11 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair) return 1; } break; - + case version_dir: /* Already processed */ break; - + case archive_dir: if (archive_file (trp, dpair, relative_dir, val)) return 1; @@ -369,7 +369,7 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair) val, strerror (rc)); return 1; } - + if (argc != 2) { rc = 1; @@ -379,13 +379,13 @@ process_directives (struct file_triplet *trp, struct directory_pair *dpair) } else rc = symlink_file (trp, dpair, relative_dir, argv[0], argv[1]); - + argcv_free (argc, argv); if (rc) return 1; } break; - + case rmsymlink_dir: if (rmsymlink_file (trp, dpair, relative_dir, val)) return 1; diff --git a/src/diskio.c b/src/diskio.c index 18f3960..e30b215 100644 --- a/src/diskio.c +++ b/src/diskio.c @@ -32,7 +32,7 @@ sub_dir_p (char *arg, char *dir) if (!arg) return 0; - + dlen = strlen (dir); return strlen (arg) > dlen @@ -49,7 +49,7 @@ concat_dir (const char *base, const char *name, size_t *pbaselen) size_t len = strlen (base); size_t size; char *dir; - + while (len > 0 && base[len-1] == '/') len--; @@ -72,7 +72,7 @@ create_hierarchy (char *dir, size_t baselen, uid_t uid, gid_t gid) int rc; struct stat st; char *p; - + if (stat (dir, &st) == 0) { if (!S_ISDIR (st.st_mode)) @@ -87,7 +87,7 @@ create_hierarchy (char *dir, size_t baselen, uid_t uid, gid_t gid) logmsg (LOG_ERR, "cannot stat file %s: %s", dir, strerror (errno)); return 1; } - + p = strrchr (dir, '/'); if (p) { @@ -162,7 +162,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid) close (in_fd); return 1; } - + out_fd = creat (dst_file, CREAT_PERMISSIONS); if (out_fd == -1) { @@ -171,13 +171,13 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid) close (in_fd); return 1; } - + #ifdef USE_SENDFILE if (enable_sendfile) { off_t offset = 0; ssize_t count; - + count = sendfile (out_fd, in_fd, &offset, st.st_size); if (count == -1) { @@ -205,7 +205,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid) char *buf = NULL; size_t bufsize; size_t fsize = st.st_size; - + for (bufsize = fsize; bufsize > 0 && (buf = malloc (bufsize)) == NULL; bufsize /= 2) ; @@ -217,7 +217,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid) { size_t rest; size_t rdbytes; - + rest = fsize > bufsize ? bufsize : fsize; rdbytes = read (in_fd, buf, rest); if (rdbytes == -1) @@ -234,7 +234,7 @@ copy_file (const char *file, const char *dst_file, uid_t uid, gid_t gid) dst_file, strerror (errno)); rc = copy_failed; break; - } + } else if (rest != rdbytes) { logmsg (LOG_ERR, "short write on %s", dst_file); @@ -295,7 +295,7 @@ int tar_append_file (const char *archive, const char *file) { const char *argv[6]; - + if (debug_level) logmsg (LOG_DEBUG, "tarring %s to %s", file, archive); if (dry_run_mode) @@ -344,7 +344,7 @@ backup_file (const char *dst_file, const char *dst_dir, const char *file, int rc = 0; char *adir; char *file_name; - + if (archive->name[0] == '/') adir = create_directory (archive->name, reldir, uid, gid); else @@ -405,7 +405,7 @@ backup_file (const char *dst_file, const char *dst_dir, const char *file, free (file_name); free (adir); return rc; -} +} /* Select the appropriate backup type and backup a file. See backup_file for the argument description. */ @@ -421,7 +421,7 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file, case archive_directory: return backup_file (dst_file, dst_dir, file, archive, uid, gid, reldir); - + case archive_tar: if (tar_append_file (archive->name, dst_file)) return 1; @@ -442,17 +442,17 @@ do_archive_file (const char *dst_file, const char *dst_dir, const char *file, Do nothing if dry_run_mode is set. */ int move_file (struct file_triplet *trp, struct directory_pair *dpair, - enum file_type file_id, const char *reldir) + enum file_type file_id, const char *reldir) { char *dst_file; int rc = 0; char *dst_dir = create_directory (dpair->dest_dir, reldir, TRIPLET_UID (trp), TRIPLET_GID (trp)); - + if (!dst_dir) return 1; dst_file = concat_dir (dst_dir, trp->file[file_id].name, NULL); - + if (debug_level) logmsg (LOG_DEBUG, "installing %s to %s", trp->file[file_id].name, dst_dir); @@ -461,11 +461,11 @@ move_file (struct file_triplet *trp, struct directory_pair *dpair, rc = do_archive_file (dst_file, dst_dir, trp->file[file_id].name, &dpair->archive, TRIPLET_UID (trp), TRIPLET_GID (trp), reldir); - + if (!dry_run_mode && rc == 0) rc = do_move_file (trp->file[file_id].name, dst_file, TRIPLET_UID (trp), TRIPLET_GID (trp)); - + free (dst_file); free (dst_dir); if (rc == 0) @@ -486,7 +486,7 @@ archive_single_file (struct file_triplet *trp, struct directory_pair *dpair, int rc = 0; char *dst_dir = create_directory (dpair->dest_dir, reldir, TRIPLET_UID (trp), TRIPLET_GID (trp)); - + if (!dst_dir) return 1; @@ -499,7 +499,7 @@ archive_single_file (struct file_triplet *trp, struct directory_pair *dpair, free (dst_dir); return 1; } - + if (access (dst_file, F_OK) == 0) { if (debug_level) @@ -521,7 +521,7 @@ archive_single_file (struct file_triplet *trp, struct directory_pair *dpair, dst_file, strerror (errno)); rc = 1; } - + free (dst_file); free (dst_dir); return rc; @@ -531,7 +531,7 @@ static char * make_signame (const char *file_name) { size_t len; - + if (((len = strlen (file_name)) > SUF_SIG_LEN && memcmp (file_name + len - SUF_SIG_LEN, SUF_SIG, SUF_SIG_LEN))) { @@ -549,11 +549,11 @@ make_signame (const char *file_name) */ int archive_file (struct file_triplet *trp, struct directory_pair *dpair, - const char *reldir, const char *file_name) + const char *reldir, const char *file_name) { int rc; char *signame; - + rc = archive_single_file (trp, dpair, file_name, reldir, 0); if (rc == 0 && archive_signatures && (signame = make_signame (file_name))) { @@ -577,7 +577,7 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair, char *dst_dir = create_directory (dpair->dest_dir, reldir, TRIPLET_UID (trp), TRIPLET_GID (trp)); char *src, *dst; - + if (!dst_dir) return 1; @@ -587,7 +587,7 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair, strerror (errno)); return 1; } - + src = safe_file_name_alloc (wanted_src); if (!src || src[0] == '/') { @@ -606,20 +606,20 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair, free (dst); return 1; } - + if (debug_level) logmsg (LOG_DEBUG, "symlinking %s to %s in directory %s", src, dst, dst_dir); - + if (!dry_run_mode) { char *p = strrchr (dst, '/'); if (p > dst) { char *dir; - + *p = 0; - dir = create_directory (dpair->dest_dir, dst, + dir = create_directory (dpair->dest_dir, dst, TRIPLET_UID (trp), TRIPLET_GID (trp)); if (!dir) rc = 1; @@ -627,7 +627,7 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair, free (dir); *p = '/'; } - + if (rc == 0) { if (chdir (dst_dir)) @@ -636,7 +636,7 @@ symlink_file (struct file_triplet *trp, struct directory_pair *dpair, else { struct stat st; - + if (lstat (dst, &st) == 0) { if (!S_ISLNK (st.st_mode)) @@ -694,10 +694,10 @@ static int do_rmsymlink_file (const char *dst_file, int noentok) { struct stat st; - + if (debug_level) logmsg (LOG_DEBUG, "Removing symbolic link %s", dst_file); - + if (stat (dst_file, &st)) { if (errno == ENOENT) @@ -723,7 +723,7 @@ do_rmsymlink_file (const char *dst_file, int noentok) } /* Remove the symbolic link DPAIR->dest_dir/RELDIR/FILE_NAME - + Get ownership information from TRP. Do nothing if dry_run_mode is set. */ @@ -757,9 +757,9 @@ rmsymlink_file (struct file_triplet *trp, struct directory_pair *dpair, rc = do_rmsymlink_file (signame, 1); free (signame); } - + free (dst_file); free (dst_dir); return rc; } - + @@ -50,7 +50,7 @@ start_prog (int argc, const char **argv, pid_t *ppid) execvp (argv[0], (char**) argv); logmsg (LOG_CRIT, "cannot run %s: %s", argv[0], strerror (errno)); exit (1); - + case -1: logmsg (LOG_CRIT, "cannot run `%s': fork failed: %s", argv[0], strerror (errno)); @@ -74,7 +74,7 @@ log_output (int prio, const char *prog, FILE *fp) { size_t size = 0; char *buf = NULL; - + logmsg (prio, "%s output follows:", prog); while (getline (&buf, &size, fp) > 0) logmsg (prio, "%s", buf); @@ -91,14 +91,14 @@ wydawca_exec (int argc, const char **argv, int *retcode) int status; int i; enum exec_result res; - + fp = start_prog (5, argv, &pid); if (!fp) { logmsg (LOG_CRIT, "cannot start %s", argv[0]); return exec_error; } - + for (i = 0; i < 5 && (npid = waitpid (pid, &status, WNOHANG)) == 0; i++) sleep (1); @@ -118,7 +118,7 @@ wydawca_exec (int argc, const char **argv, int *retcode) kill (pid, SIGKILL); fclose (fp); return exec_error; - + default: break; } @@ -155,6 +155,6 @@ wydawca_exec (int argc, const char **argv, int *retcode) argv[0]); } fclose (fp); - + return res; } diff --git a/src/getopt.m4 b/src/getopt.m4 index d6f5580..83cc45f 100644 --- a/src/getopt.m4 +++ b/src/getopt.m4 @@ -1,6 +1,6 @@ dnl This file is part of GNU Rush. dnl Copyright (C) 2007, 2008, 2009 Sergey Poznyakoff. -dnl +dnl dnl GNU Rush is free software; you can redistribute it and/or modify dnl it under the terms of the GNU General Public License as published by dnl the Free Software Foundation; either version 3, or (at your option) @@ -66,7 +66,7 @@ dnl define([<GROUP>],[<dnl divert(3) { NULL, NULL, 0, N_("prep([<$1>])") }, -divert(-1)>]) +divert(-1)>]) define([<__GATHER_OPTIONS>],[< define([<KEY>],ifelse([<$2>],,[<OPTION_>]upcase(patsubst($1,-,_)),'$2')) @@ -92,12 +92,12 @@ ifelse([<$2>],,,dnl dnl OPTION(long-opt, short-opt, [arg], [descr]) dnl Introduce a command line option. Arguments: -dnl long-opt Long option. +dnl long-opt Long option. dnl short-opt Short option (a single char) dnl (At least one of long-opt or short-opt must be present) dnl dnl Optional arguments: -dnl arg Option argument. +dnl arg Option argument. dnl descr Option description dnl dnl If arg is absent, the option does not take any arguments. If arg is @@ -124,7 +124,7 @@ dnl long-opt Long option. dnl short-opt Short option (a single char) dnl (At least one of long-opt or short-opt must be present) dnl An OPTION statement may be followed by any number of ALIAS statements. -dnl +dnl define([<ALIAS>],[< __GATHER_OPTIONS($1,$2) >]) @@ -180,11 +180,11 @@ ifelse([<$#>],3,opterr = 0;) { default: ifelse([<$#>],3,$3,[<exit(1)>]); - + undivert(4) } } - } + } >]) define([<STDFUNC>],[< @@ -196,19 +196,19 @@ const char *program_version = [<$1>]; static char doc[] = N_("[<$3>]"); static char args_doc[] = N_("[<$4>]"); const char *program_bug_address = "<" PACKAGE_BUGREPORT ">"; - + #define DESCRCOLUMN 30 #define RMARGIN 79 #define GROUPCOLUMN 2 #define USAGECOLUMN 13 - + static void indent (size_t start, size_t col) { for (; start < col; start++) putchar (' '); } - + static void print_option_descr (const char *descr, size_t lmargin, size_t rmargin) { @@ -243,9 +243,9 @@ void print_help(void) { unsigned i; - + printf ("%s %s [%s]... %s\n", _("Usage:"), [<$2>], _("[<OPTION>]"), - gettext (args_doc)); + gettext (args_doc)); if (doc && doc[0]) print_option_descr(gettext (doc), 0, RMARGIN); putchar ('\n'); @@ -294,7 +294,7 @@ print_help(void) putchar ('\n'); } } - + putchar ('\n'); dnl ************************************ |