Skip to content

Commit 999aab7

Browse files
committed
docs: Replace spaces with tabs in check-sysctl-docs
Remove the combination of spaces and tabs in favor of just tabs. Signed-off-by: Joel Granados <[email protected]>
1 parent 30ec9fd commit 999aab7

File tree

1 file changed

+81
-82
lines changed

1 file changed

+81
-82
lines changed

scripts/check-sysctl-docs

Lines changed: 81 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@
1313
# Specify -vdebug=1 to see debugging information
1414

1515
BEGIN {
16-
if (!table) {
16+
if (!table) {
1717
print "Please specify the table to look for using the table variable" > "/dev/stderr"
1818
exit 1
19-
}
19+
}
2020

2121
# Documentation title skiplist
2222
skiplist[0] = "^Documentation for"
@@ -43,23 +43,23 @@ BEGIN {
4343

4444
# Remove punctuation from the given value
4545
function trimpunct(value) {
46-
while (value ~ /^["&]/) {
47-
value = substr(value, 2)
48-
}
49-
while (value ~ /[]["&,}]$/) {
50-
value = substr(value, 1, length(value) - 1)
51-
}
52-
return value
46+
while (value ~ /^["&]/) {
47+
value = substr(value, 2)
48+
}
49+
while (value ~ /[]["&,}]$/) {
50+
value = substr(value, 1, length(value) - 1)
51+
}
52+
return value
5353
}
5454

5555
# Print the information for the given entry
5656
function printentry(entry) {
57-
seen[entry]++
58-
printf "* %s from %s", entry, file[entry]
59-
if (documented[entry]) {
60-
printf " (documented)"
61-
}
62-
print ""
57+
seen[entry]++
58+
printf "* %s from %s", entry, file[entry]
59+
if (documented[entry]) {
60+
printf " (documented)"
61+
}
62+
print ""
6363
}
6464

6565

@@ -71,105 +71,104 @@ FNR == NR && /^=+$/ {
7171
}
7272
}
7373

74-
# The previous line is a section title, parse it
75-
$0 = prevline
76-
if (debug) print "Parsing " $0
77-
inbrackets = 0
78-
for (i = 1; i <= NF; i++) {
79-
if (length($i) == 0) {
80-
continue
81-
}
82-
if (!inbrackets && substr($i, 1, 1) == "(") {
83-
inbrackets = 1
84-
}
85-
if (!inbrackets) {
86-
token = trimpunct($i)
87-
if (length(token) > 0 && token != "and") {
88-
if (debug) print trimpunct($i)
89-
documented[trimpunct($i)]++
90-
}
91-
}
92-
if (inbrackets && substr($i, length($i), 1) == ")") {
93-
inbrackets = 0
74+
# The previous line is a section title, parse it
75+
$0 = prevline
76+
if (debug) print "Parsing " $0
77+
inbrackets = 0
78+
for (i = 1; i <= NF; i++) {
79+
if (length($i) == 0) {
80+
continue
81+
}
82+
if (!inbrackets && substr($i, 1, 1) == "(") {
83+
inbrackets = 1
84+
}
85+
if (!inbrackets) {
86+
token = trimpunct($i)
87+
if (length(token) > 0 && token != "and") {
88+
if (debug) print trimpunct($i)
89+
documented[trimpunct($i)]++
90+
}
91+
}
92+
if (inbrackets && substr($i, length($i), 1) == ")") {
93+
inbrackets = 0
94+
}
9495
}
95-
}
9696
}
9797

9898
FNR == NR {
99-
prevline = $0
100-
next
99+
prevline = $0
100+
next
101101
}
102102

103103

104104
# Stage 2: process each file and find all sysctl tables
105105
BEGINFILE {
106-
delete entries
107-
curtable = ""
108-
curentry = ""
109-
delete vars
110-
if (debug) print "Processing file " FILENAME
106+
delete entries
107+
curtable = ""
108+
curentry = ""
109+
delete vars
110+
if (debug) print "Processing file " FILENAME
111111
}
112112

113113
/^static( const)? struct ctl_table/ {
114-
match($0, /static( const)? struct ctl_table ([^][]+)/, tables)
115-
curtable = tables[2]
116-
if (debug) print "Processing table " curtable
114+
match($0, /static( const)? struct ctl_table ([^][]+)/, tables)
115+
curtable = tables[2]
116+
if (debug) print "Processing table " curtable
117117
}
118118

119119
/^};$/ {
120-
curtable = ""
121-
curentry = ""
122-
delete vars
120+
curtable = ""
121+
curentry = ""
122+
delete vars
123123
}
124124

125125
curtable && /\.procname[\t ]*=[\t ]*".+"/ {
126-
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
127-
curentry = names[1]
128-
if (debug) print "Adding entry " curentry " to table " curtable
129-
entries[curtable][curentry]++
130-
file[curentry] = FILENAME
126+
match($0, /.procname[\t ]*=[\t ]*"([^"]+)"/, names)
127+
curentry = names[1]
128+
if (debug) print "Adding entry " curentry " to table " curtable
129+
entries[curtable][curentry]++
130+
file[curentry] = FILENAME
131131
}
132132

133133
curtable && /UCOUNT_ENTRY.*/ {
134-
match($0, /UCOUNT_ENTRY\("([^"]+)"\)/, names)
135-
curentry = names[1]
136-
if (debug) print "Adding entry " curentry " to table " curtable
137-
entries[curtable][curentry]++
138-
file[curentry] = FILENAME
134+
match($0, /UCOUNT_ENTRY\("([^"]+)"\)/, names)
135+
curentry = names[1]
136+
if (debug) print "Adding entry " curentry " to table " curtable
137+
entries[curtable][curentry]++
138+
file[curentry] = FILENAME
139139
}
140140

141141
/register_sysctl.*/ {
142-
match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables)
143-
if (debug) print "Registering table " tables[3] " at " tables[2]
144-
if (tables[2] == table) {
145-
for (entry in entries[tables[3]]) {
146-
printentry(entry)
147-
}
148-
}
142+
match($0, /register_sysctl(|_init|_sz)\("([^"]+)" *, *([^,)]+)/, tables)
143+
if (debug) print "Registering table " tables[3] " at " tables[2]
144+
if (tables[2] == table) {
145+
for (entry in entries[tables[3]]) {
146+
printentry(entry)
147+
}
148+
}
149149
}
150150

151151
/kmemdup.*/ {
152-
match($0, /([^ \t]+) *= *kmemdup\(([^,]+) *,/, names)
153-
if (debug) print "Found variable " names[1] " for table " names[2]
154-
if (names[2] in entries) {
155-
vars[names[1]] = names[2]
156-
}
152+
match($0, /([^ \t]+) *= *kmemdup\(([^,]+) *,/, names)
153+
if (debug) print "Found variable " names[1] " for table " names[2]
154+
if (names[2] in entries) {
155+
vars[names[1]] = names[2]
156+
}
157157
}
158158

159159
/__register_sysctl_table.*/ {
160-
match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, tables)
161-
if (debug) print "Registering variable table " tables[2] " at " tables[1]
162-
if (tables[1] == table && tables[2] in vars) {
163-
for (entry in entries[vars[tables[2]]]) {
164-
printentry(entry)
165-
}
166-
}
160+
match($0, /__register_sysctl_table\([^,]+, *"([^"]+)" *, *([^,]+)/, tables)
161+
if (debug) print "Registering variable table " tables[2] " at " tables[1]
162+
if (tables[1] == table && tables[2] in vars) {
163+
for (entry in entries[vars[tables[2]]]) {
164+
printentry(entry)
165+
}
166+
}
167167
}
168168

169169
END {
170-
for (entry in documented) {
171-
if (!seen[entry]) {
172-
print "No implementation for " entry
170+
for (entry in documented) {
171+
if (!seen[entry])
172+
print "No implementation for " entry
173173
}
174-
}
175174
}

0 commit comments

Comments
 (0)