From 8252f94084a3b9a9ceb62338177d31fdff896b5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Mangano-Tarumi?= Date: Sat, 10 Oct 2020 16:27:52 +0200 Subject: [PATCH] --set-all: Ignore comments starting with # --- opustags.1 | 2 +- src/cli.cc | 2 ++ t/opustags.t | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/opustags.1 b/opustags.1 index 366a563..8bb64f3 100644 --- a/opustags.1 +++ b/opustags.1 @@ -97,7 +97,7 @@ Delete all the previously existing tags. Sets the tags from scratch. All the original tags are deleted and new ones are read from standard input. Each line must specify a \fIFIELD=VALUE\fP pair and be separated with line feeds. -Blank lines are ignored. +Blank lines and lines starting with \fI#\fP are ignored. .SH EXAMPLES .PP List all the tags in file foo.opus: diff --git a/src/cli.cc b/src/cli.cc index 9141892..909629f 100644 --- a/src/cli.cc +++ b/src/cli.cc @@ -202,6 +202,8 @@ ot::status ot::read_comments(FILE* input, std::list& comments) --nread; if (nread == 0) continue; + if (line[0] == '#') // comment + continue; if (memchr(line, '=', nread) == nullptr) { ot::status rc = {ot::st::error, "Malformed tag: " + std::string(line, nread)}; free(line); diff --git a/t/opustags.t b/t/opustags.t index c21a094..b6334b8 100755 --- a/t/opustags.t +++ b/t/opustags.t @@ -179,6 +179,7 @@ ARTIST=七面鳥 A=A X=Y +#IGNORE=COMMENTS END_IN OK=yes again ARTIST=七面鳥