Subversion Repositories

?revision_form?Rev ?revision_input??revision_submit??revision_endform?

Rev 5 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 magnus 1
#!/bin/sh
2
## 01_line-endings.dpatch by Magnus Holmgren <magnus@kibibyte.se>
3
##
4
## All lines beginning with `## DP:' are a description of the patch.
5
## DP: Convert CRLF line endings to LF in certain Windows-related files
6
 
7
FILES_WITH_CRLF="src/libspf2/spf_dns_windns.c
8
                 src/libspf2/spf_win32.c
9
                 src/libreplace/win32_config.h
10
                 src/include/spf_dns_windns.h
11
                 src/include/spf_win32.h"
12
 
13
set -e
14
 
15
dpatch_patch() {
16
    # Change line endings to LF in files with CRLF
17
    sed -ri -e 's/\r$//' $FILES_WITH_CRLF
18
}
19
 
20
dpatch_unpatch() {
21
    # Change line endings back to CRLF in files that had it in the tarball
22
    # Unfortunately there are exceptions ... have to watch out for changes
23
    # in future upstream versions (or simply make backups instead).
24
    sed -ri -e '/\r$|^#pragma comment/!s/$/\r/' $FILES_WITH_CRLF
25
    sed -ri -e '$s/\r$//' src/libspf2/spf_dns_windns.c
26
}
27
 
28
DPATCH_LIB_NO_DEFAULT=1
29
 
30
. /usr/share/dpatch/dpatch.lib.sh