Skip to content

Commit 9a02499

Browse files
committed
Merge branch 'kk/build-portability-fix'
Portability tweak for some shell scripts used while building. * kk/build-portability-fix: Fit to Plan 9's ANSI/POSIX compatibility layer
2 parents 4aff18a + b3b753b commit 9a02499

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

generate-cmdlist.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ command_list () {
1010
}
1111

1212
get_categories () {
13-
tr ' ' '\n'|
13+
tr ' ' '\012'|
1414
grep -v '^$' |
1515
sort |
1616
uniq

t/chainlint.sed

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
/^[ ]*!*[ ]*(..*)[ ]*[0-9]*[<>|&]/boneline
118118

119119
# multi-line "(...\n...)"
120-
/^[ ]*(/bsubshell
120+
/^[ ]*(/bsubsh
121121

122122
# innocuous line -- print it and advance to next line
123123
b
@@ -130,11 +130,11 @@ b
130130
}
131131
b
132132

133-
:subshell
133+
:subsh
134134
# bare "(" line? -- stash for later printing
135135
/^[ ]*([ ]*$/ {
136136
h
137-
bnextline
137+
bnextln
138138
}
139139
# "(..." line -- split off and stash "(", then process "..." as its own line
140140
x
@@ -143,18 +143,18 @@ x
143143
s/(//
144144
bslurp
145145

146-
:nextline
146+
:nextln
147147
N
148148
s/.*\n//
149149

150150
:slurp
151151
# incomplete line "...\"
152152
/\\$/bicmplte
153153
# multi-line quoted string "...\n..."?
154-
/"/bdqstring
154+
/"/bdqstr
155155
# multi-line quoted string '...\n...'? (but not contraction in string "it's")
156156
/'/{
157-
/"[^'"]*'[^'"]*"/!bsqstring
157+
/"[^'"]*'[^'"]*"/!bsqstr
158158
}
159159
:folded
160160
# here-doc -- swallow it
@@ -163,8 +163,8 @@ s/.*\n//
163163
# before closing ")", "done", "elsif", "else", or "fi" will need to be
164164
# re-visited to drop "suspect" marking since final line of those constructs
165165
# legitimately lacks "&&", so "suspect" mark must be removed
166-
/^[ ]*#/bnextline
167-
/^[ ]*$/bnextline
166+
/^[ ]*#/bnextln
167+
/^[ ]*$/bnextln
168168
# in-line comment -- strip it (but not "#" in a string, Bash ${#...} array
169169
# length, or Perforce "//depot/path#42" revision in filespec)
170170
/[ ]#/{
@@ -175,22 +175,22 @@ s/.*\n//
175175
# multi-line "case ... esac"
176176
/^[ ]*case[ ]..*[ ]in/bcase
177177
# multi-line "for ... done" or "while ... done"
178-
/^[ ]*for[ ]..*[ ]in/bcontinue
179-
/^[ ]*while[ ]/bcontinue
180-
/^[ ]*do[ ]/bcontinue
181-
/^[ ]*do[ ]*$/bcontinue
182-
/;[ ]*do/bcontinue
178+
/^[ ]*for[ ]..*[ ]in/bcont
179+
/^[ ]*while[ ]/bcont
180+
/^[ ]*do[ ]/bcont
181+
/^[ ]*do[ ]*$/bcont
182+
/;[ ]*do/bcont
183183
/^[ ]*done[ ]*&&[ ]*$/bdone
184184
/^[ ]*done[ ]*$/bdone
185185
/^[ ]*done[ ]*[<>|]/bdone
186186
/^[ ]*done[ ]*)/bdone
187-
/||[ ]*exit[ ]/bcontinue
188-
/||[ ]*exit[ ]*$/bcontinue
187+
/||[ ]*exit[ ]/bcont
188+
/||[ ]*exit[ ]*$/bcont
189189
# multi-line "if...elsif...else...fi"
190-
/^[ ]*if[ ]/bcontinue
191-
/^[ ]*then[ ]/bcontinue
192-
/^[ ]*then[ ]*$/bcontinue
193-
/;[ ]*then/bcontinue
190+
/^[ ]*if[ ]/bcont
191+
/^[ ]*then[ ]/bcont
192+
/^[ ]*then[ ]*$/bcont
193+
/;[ ]*then/bcont
194194
/^[ ]*elif[ ]/belse
195195
/^[ ]*elif[ ]*$/belse
196196
/^[ ]*else[ ]/belse
@@ -234,10 +234,10 @@ s/.*\n//
234234
}
235235
}
236236
# line ends with pipe "...|" -- valid; not missing "&&"
237-
/|[ ]*$/bcontinue
237+
/|[ ]*$/bcont
238238
# missing end-of-line "&&" -- mark suspect
239239
/&&[ ]*$/!s/^/?!AMP?!/
240-
:continue
240+
:cont
241241
# retrieve and print previous line
242242
x
243243
n
@@ -250,29 +250,29 @@ s/\\\n//
250250
bslurp
251251

252252
# check for multi-line double-quoted string "...\n..." -- fold to one line
253-
:dqstring
253+
:dqstr
254254
# remove all quote pairs
255255
s/"\([^"]*\)"/@!\1@!/g
256256
# done if no dangling quote
257257
/"/!bdqdone
258258
# otherwise, slurp next line and try again
259259
N
260260
s/\n//
261-
bdqstring
261+
bdqstr
262262
:dqdone
263263
s/@!/"/g
264264
bfolded
265265

266266
# check for multi-line single-quoted string '...\n...' -- fold to one line
267-
:sqstring
267+
:sqstr
268268
# remove all quote pairs
269269
s/'\([^']*\)'/@!\1@!/g
270270
# done if no dangling quote
271271
/'/!bsqdone
272272
# otherwise, slurp next line and try again
273273
N
274274
s/\n//
275-
bsqstring
275+
bsqstr
276276
:sqdone
277277
s/@!/'/g
278278
bfolded
@@ -282,11 +282,11 @@ bfolded
282282
:heredoc
283283
s/^\(.*\)<<[ ]*[-\\'"]*\([A-Za-z0-9_][A-Za-z0-9_]*\)['"]*/<\2>\1<</
284284
s/[ ]*<<//
285-
:heredsub
285+
:hdocsub
286286
N
287287
/^<\([^>]*\)>.*\n[ ]*\1[ ]*$/!{
288288
s/\n.*$//
289-
bheredsub
289+
bhdocsub
290290
}
291291
s/^<[^>]*>//
292292
s/\n.*$//
@@ -305,7 +305,7 @@ bcase
305305
x
306306
s/?!AMP?!//
307307
x
308-
bcontinue
308+
bcont
309309

310310
# found "done" closing for-loop or while-loop, or "fi" closing if-then -- drop
311311
# "suspect" from final contained line since that line legitimately lacks "&&"
@@ -321,22 +321,22 @@ bchkchn
321321
# found nested multi-line "(...\n...)" -- pass through untouched
322322
:nest
323323
x
324-
:nstslurp
324+
:nstslrp
325325
n
326326
# closing ")" on own line -- stop nested slurp
327-
/^[ ]*)/bnstclose
327+
/^[ ]*)/bnstcl
328328
# comment -- not closing ")" if in comment
329329
/^[ ]*#/bnstcnt
330330
# "$((...))" -- arithmetic expansion; not closing ")"
331331
/\$(([^)][^)]*))[^)]*$/bnstcnt
332332
# "$(...)" -- command substitution; not closing ")"
333333
/\$([^)][^)]*)[^)]*$/bnstcnt
334334
# closing "...)" -- stop nested slurp
335-
/)/bnstclose
335+
/)/bnstcl
336336
:nstcnt
337337
x
338-
bnstslurp
339-
:nstclose
338+
bnstslrp
339+
:nstcl
340340
s/^/>>/
341341
# is it "))" which closes nested and parent subshells?
342342
/)[ ]*)/bslurp

0 commit comments

Comments
 (0)