From a228c720918d658261e822968c10d289d6afd078 Mon Sep 17 00:00:00 2001
From: "Todd C. Miller" <Todd.Miller@courtesan.com>
Date: Mon, 18 Feb 2008 15:53:33 +0000
Subject: [PATCH] Substitute in comment characters for lines partaining to
 login.conf, BSD auth and SELinux and only enable them if pertinent.

---
 sudo.man.pl | 25 ++++++++++++++++---------
 1 file changed, 16 insertions(+), 9 deletions(-)

diff --git a/sudo.man.pl b/sudo.man.pl
index fc45ead40..91ea24db4 100644
--- a/sudo.man.pl
+++ b/sudo.man.pl
@@ -1,16 +1,23 @@
 #!/usr/bin/perl -p
 
 BEGIN {
-    $prepend = 0;
+    %tags = ( 'a', '@BAMAN@', 'c', '@LCMAN@', 'r', '@SEMAN@', 't', '@SEMAN@');
+    $t = undef;
 }
-if (/-r.*role.*-t.*type/) {
-    # comment out SELinux-specific line in SYNOPSIS
-    s/^/\@SEMAN\@/;
-} elsif (/^\.IP(.*-[rt])?/) {
-    $prepend = defined($1);
+if (/^\.IP(.*-([acrt]))?/) {
+    $t = $1 ? $tags{$2} : undef;
+} elsif (/-a.*auth_type/) {
+    $_ = $tags{'a'} . $_;
+} elsif (/-c.*class.*\|/) {
+    $_ = $tags{'c'} . $_;
+} elsif (/-r.*role.*-t.*type/) {
+    $_ = $tags{'r'} . $_;
 }
 
-# comment out SELinux-specific lines in DESCRIPTION
-if ($prepend) {
-    s/^/\@SEMAN\@/;
+# Fix up broken pod2man formatting of F<@foo@/bar>
+s/\\fI\\f(\(C)?I\@([^\@]*)\\fI\@/\\fI\@$2\@/g;
+
+# comment out Compile-time-specific lines in DESCRIPTION
+if ($t) {
+    $_ = $t . $_;
 }
-- 
2.40.0