add packaging
[platform/upstream/m4.git] / examples / join.m4
1 divert(`-1')
2 # join(sep, args) - join each non-empty ARG into a single
3 # string, with each element separated by SEP
4 define(`join',
5 `ifelse(`$#', `2', ``$2'',
6   `ifelse(`$2', `', `', ``$2'_')$0(`$1', shift(shift($@)))')')
7 define(`_join',
8 `ifelse(`$#$2', `2', `',
9   `ifelse(`$2', `', `', ``$1$2'')$0(`$1', shift(shift($@)))')')
10 # joinall(sep, args) - join each ARG, including empty ones,
11 # into a single string, with each element separated by SEP
12 define(`joinall', ``$2'_$0(`$1', shift($@))')
13 define(`_joinall',
14 `ifelse(`$#', `2', `', ``$1$3'$0(`$1', shift(shift($@)))')')
15 divert`'dnl