From: Ben Pfaff Date: Fri, 9 Mar 2012 22:50:39 +0000 (-0800) Subject: ovsdb-doc: Convert '-' preceding a number as a minus sign, not a hyphen. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a03bd69a202d1da672dde4957b4bc4fc10e7cf09;p=openvswitch ovsdb-doc: Convert '-' preceding a number as a minus sign, not a hyphen. ovs-vswitchd.conf.db.5 contains the following sentence: If the interface cannot be added then Open vSwitch sets this column to -1. The '-' in "-1" should be a minus sign, not a hyphen, but the heuristic in ovsdb-doc wasn't smart enough. This commit improves the heuristic and fixes the problem. Found by lintian. Reported-by: Thomas Goirand Reviewed-by: Simon Horman Signed-off-by: Ben Pfaff --- diff --git a/ovsdb/ovsdb-doc.in b/ovsdb/ovsdb-doc.in index 5ae6706e..a4eabc59 100755 --- a/ovsdb/ovsdb-doc.in +++ b/ovsdb/ovsdb-doc.in @@ -16,9 +16,9 @@ argv0 = sys.argv[0] def textToNroff(s, font=r'\fR'): def escape(match): c = match.group(0) - if c == '-': - if font == r'\fB': - return r'\-' + if c.startswith('-'): + if c != '-' or font == r'\fB': + return '\\' + c else: return '-' if c == '\\': @@ -31,7 +31,7 @@ def textToNroff(s, font=r'\fR'): raise error.Error("bad escape") # Escape - \ " ' as needed by nroff. - s = re.sub('([-"\'\\\\])', escape, s) + s = re.sub('(-[0-9]|[-"\'\\\\])', escape, s) if s.startswith('.'): s = '\\' + s return s