xref: /netbsd-src/external/bsd/flex/dist/po/insert-header.sin (revision 3c3a7b7603b4ed4cb76dd5c5a3e781ddca2349bb)
1*3c3a7b76Schristos# Sed script that inserts the file called HEADER before the header entry.
2*3c3a7b76Schristos#
3*3c3a7b76Schristos# At each occurrence of a line starting with "msgid ", we execute the following
4*3c3a7b76Schristos# commands. At the first occurrence, insert the file. At the following
5*3c3a7b76Schristos# occurrences, do nothing. The distinction between the first and the following
6*3c3a7b76Schristos# occurrences is achieved by looking at the hold space.
7*3c3a7b76Schristos/^msgid /{
8*3c3a7b76Schristosx
9*3c3a7b76Schristos# Test if the hold space is empty.
10*3c3a7b76Schristoss/m/m/
11*3c3a7b76Schristosta
12*3c3a7b76Schristos# Yes it was empty. First occurrence. Read the file.
13*3c3a7b76Schristosr HEADER
14*3c3a7b76Schristos# Output the file's contents by reading the next line. But don't lose the
15*3c3a7b76Schristos# current line while doing this.
16*3c3a7b76Schristosg
17*3c3a7b76SchristosN
18*3c3a7b76Schristosbb
19*3c3a7b76Schristos:a
20*3c3a7b76Schristos# The hold space was nonempty. Following occurrences. Do nothing.
21*3c3a7b76Schristosx
22*3c3a7b76Schristos:b
23*3c3a7b76Schristos}
24