[Dctrl-tools-devel] [SCM] Debian control file query tools branch, master, updated. 2.14-25-g808de4e
Antti-Juhani Kaijanaho
ajk at debian.org
Sat Aug 28 17:23:32 UTC 2010
The following commit has been merged in the master branch:
commit 808de4efa746be07aed56cb0f2bcab6a2c12f19f
Author: Antti-Juhani Kaijanaho <ajk at debian.org>
Date: Sat Aug 28 20:23:04 2010 +0300
lib/paragraph.c (para_parse_next): Fix line counting.
Signed-off-by: Antti-Juhani Kaijanaho <ajk at debian.org>
diff --git a/debian/changelog b/debian/changelog
index 88f0bae..1bb150b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -7,11 +7,12 @@ dctrl-tools (2.15) UNRELEASED; urgency=low
* Update FSF address in license blurbs all over the source tree.
* debian/copyright: Update copyright years
* Merge 2.14.1
+ * lib/paragraph.c (para_parse_next): Fix line counting.
[ Cyril Brulebois ]
* Add Build-Depends/Build-Depends-Indep search example (closes: #339380)
- -- Antti-Juhani Kaijanaho <ajk at debian.org> Sat, 28 Aug 2010 09:38:24 +0300
+ -- Antti-Juhani Kaijanaho <ajk at debian.org> Sat, 28 Aug 2010 20:20:50 +0300
dctrl-tools (2.14.1) unstable; urgency=low
diff --git a/lib/paragraph.c b/lib/paragraph.c
index c0903a2..b30a3bc 100644
--- a/lib/paragraph.c
+++ b/lib/paragraph.c
@@ -1,5 +1,5 @@
/* dctrl-tools - Debian control file inspection tools
- Copyright © 2003, 2004, 2008 Antti-Juhani Kaijanaho
+ Copyright © 2003, 2004, 2008, 2010 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
@@ -97,6 +97,7 @@ redo:
struct field_data * field_data = 0;
#define GETC (c = fsaf_getc(fp, pos++), c == '\n' ? line++ : line)
+#define UNGETC (fsaf_getc(fp, --pos) == '\n' ? --line : line)
int c;
START:
GETC;
@@ -111,7 +112,8 @@ START:
para->start++;
goto START_SKIPCOMMENT;
default:
- field_start = --pos;
+ UNGETC;
+ field_start = pos;
goto FIELD_NAME;
}
assert(0);
@@ -135,7 +137,7 @@ FIELD_NAME:
switch (c) {
case '\n': case -1:
if (pp->ignore_broken_paras) {
- line_message(L_IMPORTANT, fp->fname,
+ line_message(L_IMPORTANT, fp->fname,
c == '\n' ?line-1:line,
_("warning: expected a colon"));
goto FAIL;
@@ -208,7 +210,8 @@ BODY_NEWLINE:
case '#':
goto BODY_SKIPCOMMENT;
default:
- field_start = --pos;
+ UNGETC;
+ field_start = pos;
goto FIELD_NAME;
}
assert(0);
@@ -249,7 +252,9 @@ FAIL:
goto redo;
END:
- para->end = pos-2;
+ UNGETC;
+ UNGETC;
+ para->end = pos;
pp->loc = para->end;
- pp->line = fsaf_getc(fp, pp->loc) == '\n' ? line-1 : line;
+ pp->line = line;
}
diff --git a/tests/0010.err b/tests/0010.err
new file mode 100644
index 0000000..4b9f606
--- /dev/null
+++ b/tests/0010.err
@@ -0,0 +1,2 @@
+../grep-dctrl/grep-dctrl: -:3: expected a colon
+.
\ No newline at end of file
diff --git a/tests/0006.out b/tests/0010.fails
similarity index 100%
copy from tests/0006.out
copy to tests/0010.fails
diff --git a/tests/0010.in b/tests/0010.in
new file mode 100644
index 0000000..8f2920d
--- /dev/null
+++ b/tests/0010.in
@@ -0,0 +1,6 @@
+Foo: bar
+
+bar
+baz
+
+xyzzy
diff --git a/tests/0010.sh b/tests/0010.sh
new file mode 100644
index 0000000..1fed9f1
--- /dev/null
+++ b/tests/0010.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+LC_ALL=C
+export LC_ALL
+
+$GREP_DCTRL ''
diff --git a/tests/0011.err b/tests/0011.err
new file mode 100644
index 0000000..5200d77
--- /dev/null
+++ b/tests/0011.err
@@ -0,0 +1,2 @@
+../grep-dctrl/grep-dctrl: -:5: expected a colon
+.
\ No newline at end of file
diff --git a/tests/0006.out b/tests/0011.fails
similarity index 100%
copy from tests/0006.out
copy to tests/0011.fails
diff --git a/tests/0011.in b/tests/0011.in
new file mode 100644
index 0000000..fe4ab13
--- /dev/null
+++ b/tests/0011.in
@@ -0,0 +1,7 @@
+Foo: bar
+
+Foo: bar
+
+error
+
+Whatever: here
diff --git a/tests/0011.sh b/tests/0011.sh
new file mode 100644
index 0000000..1fed9f1
--- /dev/null
+++ b/tests/0011.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+LC_ALL=C
+export LC_ALL
+
+$GREP_DCTRL ''
--
Debian control file query tools
More information about the Dctrl-tools-devel
mailing list