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