summaryrefslogtreecommitdiff
blob: 8b774844cb8a49c34644ed93fd05eb11c5ad785f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2

# @ECLASS: edos2unix.eclass
# @MAINTAINER:
# base-system@gentoo.org
# @BLURB: convert files from DOS CRLF to UNIX LF line endings

# @FUNCTION: edos2unix
# @USAGE: <file> [more files ...]
# @DESCRIPTION:
# A handy replacement for dos2unix, recode, fixdos, etc...  This allows
# you to remove all of these text utilities from DEPEND variables
# because this is a script based solution.  Just give it a list of files
# to convert and they will all be changed from the DOS CRLF format to
# the UNIX LF format.

edos2unix() {
	[[ $# -eq 0 ]] && return 0
	sed -i 's/\r$//' -- "$@" || die
}