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