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