texk/kpathsea/bsnl.awk
raw| 1 | # bsnl.awk - eliminate backslash-newline sequences |
| 2 | # Public domain. Originally written 2010, Karl Berry. |
| 3 | |
| 4 | # on a line ending with a backslash, save it (minus the backslash). |
| 5 | /\\$/ { |
| 6 | buf = buf substr ($0, 1, length ($0) - 1); |
| 7 | next; |
| 8 | } |
| 9 | |
| 10 | # on other lines, print the buffer if there is one, then the regular line. |
| 11 | { |
| 12 | if (buf) { |
| 13 | printf "%s", buf; # don't print a newline |
| 14 | buf = ""; |
| 15 | } |
| 16 | print; |
| 17 | } |