File: configreplacements

package info (click to toggle)
yodl 3.04.00-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 4,272 kB
  • ctags: 873
  • sloc: ansic: 7,670; perl: 683; sh: 358; makefile: 205; xml: 190; cpp: 155
file content (33 lines) | stat: -rwxr-xr-x 701 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

CONFIG="tmp/wip/config.h"

    # This script changes all definitions of elements in $CONFIG in the
    # file passed as arg 1, generating arg 2. 
    # The default path to the macro files in $CONFIG can be overrules
    # by a 3rd argument. 

case $# in
    (3)
        YODL_BIN=`grep YODL_BIN $CONFIG | cut -d\" -f2`
        VERSION=`grep VERSION $CONFIG | cut -d\" -f2`
        STD_INCLUDE=$3
    ;;

    (*)
        echo "Usage: $0 xxx.in xxx.yo path-to-macro-files"
        exit 1
    ;;
esac

    # Create the destination file, changing @... into the required
    # values
    #
sed '
s,@STD_INCLUDE@,'$STD_INCLUDE',g
s,@YODL_BIN@,'$YODL_BIN',g
s,@VERSION@,'$VERSION',g
' $1 > $2