File: patch

package info (click to toggle)
findlib 1.2.5%2Bdebian-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,496 kB
  • ctags: 678
  • sloc: ml: 4,661; xml: 2,445; sh: 1,322; makefile: 306
file content (18 lines) | stat: -rwxr-xr-x 498 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#! /bin/sh

# Usage: patch @VARIABLE@ value
# Environment variable USE_CYGPATH is honoured.

varname="$1"
varvalue="$2"

if [ "${USE_CYGPATH}" = "1" ]; then
    #varvalue="$(echo "$varvalue" | sed -e 's;/;\\;g')"
    varvalue="$(cygpath -w -l "$varvalue")"
    varvalue="$(echo "$varvalue" | sed -e 's;\\;\\\\\\\\;g')"
    # e.g. c:\file is transformed to c:\\\\file
fi

sed -e 's;'"$varname"';'"$varvalue"';g'
# e.g. c:\\\\file is parsed by sed as c:\\file which is correct for the
# ocaml string