summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMats Erik Andersson <debian@gisladisker.se>2011-07-19 12:00:00 +0200
committerJulien Viard de Galbert <julien@vdg.blogsite.org>2011-08-21 15:11:01 +0200
commit64584a51e5b76bf0cba6d94f8068a801bf74c5b3 (patch)
tree2670d6edcf88368e696a7296e5ca1aed6a9c3e7d
parent1afdcab9622d5248a87972b474b04f79bca00483 (diff)
Allow traditionally delimited rules.
A rule of unlimited validity must be ot the form `s/this/that', without a final delimiting dash. This will confuse traditionalists like myself, expecting 's/this/that/' to deliver the same effect. . Thus make a final dash optional, like common sed-syntax.
-rw-r--r--netsed.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/netsed.c b/netsed.c
index 24db5bd..8588fe5 100644
--- a/netsed.c
+++ b/netsed.c
@@ -588,7 +588,8 @@ int main(int argc,char* argv[]) {
if (cs) { *cs=0; cs++; }
rule[rules].forig=fs;
rule[rules].torig=ts;
- if (cs) rule_live[rules]=atoi(cs); else rule_live[rules]=-1;
+ if (cs && *cs) /* Only non-trivial quantifiers count. */
+ rule_live[rules]=atoi(cs); else rule_live[rules]=-1;
shrink_to_binary(&rule[rules]);
// printf("DEBUG: (%s) (%s)\n",rule[rules].from,rule[rules].to);
rules++;