[Dctrl-tools-devel] [dctrl-tools] 02/06: join-dctrl: Implement missing -o (Debian #679442)
Gerfried Fuchs
rhonda at debian.org
Mon Feb 23 13:03:09 UTC 2015
This is an automated email from the git hooks/post-receive script.
rhonda pushed a commit to branch debian
in repository dctrl-tools.
commit eec76fe4fe521f7fda6b50c732343bda60824032
Author: Antti-Juhani Kaijanaho <antti-juhani at kaijanaho.fi>
Date: Wed Feb 11 19:38:03 2015 +0100
join-dctrl: Implement missing -o (Debian #679442)
Signed-off-by: Antti-Juhani Kaijanaho <antti-juhani at kaijanaho.fi>
---
join-dctrl/join-dctrl.c | 20 ++++++++++++++++++--
lib/paragraph.h | 7 ++++++-
tests/bug679442.out | 3 +++
3 files changed, 27 insertions(+), 3 deletions(-)
diff --git a/join-dctrl/join-dctrl.c b/join-dctrl/join-dctrl.c
index ed883a0..f3856ac 100644
--- a/join-dctrl/join-dctrl.c
+++ b/join-dctrl/join-dctrl.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2007, 2008, 2012 Antti-Juhani Kaijanaho
+ Copyright © 2007, 2008, 2012, 2015 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -206,7 +206,23 @@ static error_t parse_opt (int key, char * arg, struct argp_state * state)
void print_para_config(struct arguments *args, para_t para[], size_t just_this)
{
if (args->num_show_fields == 0) {
- assert(false); // unimplemented as of yet
+ for (size_t i = 0; i < args->num_fnames; i++) {
+ size_t n = para_num_fields(¶[i]);
+ for (size_t j = 0; j < n; j++) {
+ for (struct field_datum * fd =
+ find_field(¶[i], j).first;
+ fd != NULL; fd = fd->next) {
+ struct fsaf_read_rv fld =
+ fsaf_read(para[i].common->fp,
+ fd->name_start,
+ fd->end -
+ fd->name_start);
+ fwrite(fld.b, 1, fld.len, stdout);
+ putchar('\n');
+ }
+ }
+ }
+ putchar('\n');
return;
}
for (size_t i = 0; i < args->num_show_fields; i++) {
diff --git a/lib/paragraph.h b/lib/paragraph.h
index c76d124..a85bb62 100644
--- a/lib/paragraph.h
+++ b/lib/paragraph.h
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2003, 2004, 2005, 2010, 2011 Antti-Juhani Kaijanaho
+ Copyright © 2003, 2004, 2005, 2010, 2011, 2015 Antti-Juhani Kaijanaho
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -70,6 +70,11 @@ void para_init(para_parser_t *, para_t *);
void para_parse_next(para_t *);
static inline
+size_t para_num_fields(para_t *p) {
+ return p->nfields;
+}
+
+static inline
struct fsaf_read_rv get_whole_para(para_t * p)
{
return fsaf_read(p->common->fp, p->start, p->end - p->start);
diff --git a/tests/bug679442.out b/tests/bug679442.out
index 67a9cc1..2941ac8 100644
--- a/tests/bug679442.out
+++ b/tests/bug679442.out
@@ -1,2 +1,5 @@
Mergefield: 1
Duplicate-field: foo
+Mergefield: 1
+Duplicate-field: foo
+
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/dctrl-tools.git
More information about the Dctrl-tools-devel
mailing list