1. Akira TAGOH
  2. libeasyfc

Commits

Akira TAGOH  committed c4d6709

Fix bashism

  • Participants
  • Parent commits f66ef15
  • Branches master

Comments (0)

Files changed (1)

File libeasyfc-gobject/gengir.sh

View file
 #! /bin/sh
 
-function type_capitalize() {
+type_capitalize() {
     __type=`echo $1|sed -e 's/_t$//'`
     __Type=''
     old_IFS=$IFS
     echo $__Type
 }
 
-function guess_type() {
+guess_type() {
     echo "`echo $1|sed -e 's/-/_/g'`_t"
 }
 
-function capitalize() {
+capitalize() {
     __in=$1
     __out=$2
     __cl=$3
     __Cl=`type_capitalize $__cl`
     __tmpsed=`mktemp gengir.XXXXXXXX`
-    echo "s/^${__cl}/${__Cl}/g
-s/\(const[ \t].*\)${__cl}/\1${__Cl}/g
-s/\([ \t].*\)_${__cl}/\1_${__Cl}/g
-s/\([\t(].*\)${__cl}/\1${__Cl}/g
-s/^\([ \t].*\)${__cl}/\1${__Cl}/g
-s/^\(}[ \t].*\)${__cl}/\1${__Cl}/g" > $__tmpsed
+    printf "s/^${__cl}/${__Cl}/g
+s/\(const[ \t].*\)${__cl}/\\\1${__Cl}/g
+s/\([ \t].*\)_${__cl}/\\\1_${__Cl}/g
+s/\([\t(].*\)${__cl}/\\\1${__Cl}/g
+s/^\([ \t].*\)${__cl}/\\\1${__Cl}/g
+s/^\(}[ \t].*\)${__cl}/\\\1${__Cl}/g" > $__tmpsed
     sed -f $__tmpsed $__in > $__out
     rm $__tmpsed
 }
 sed -i -e 's,^\(#include[ \t]<\)libeasyfc\(/ezfc-.*\)\(\.h>\),\1libeasyfc-gobject\2.gir\3,' $_tmpgen
 
 while [ 1 ]; do
-    if [ "x$type" == "xh" ]; then
+    if [ "x$type" = "xh" ]; then
 	line=`grep -E "${_ns}_.*_t[ \t].*" $_tmpgen | grep -v -E "(struct|func)"`
-    elif [ "x$type" == "xc" ]; then
+    elif [ "x$type" = "xc" ]; then
 	line=`sed -n -e '/\/\*< public >\*\//{:a p;n;b a};{d}' $_tmpgen|grep "[^#]${_ns}_.*_t[^a-z]"|grep -v -E "(func)"`
     else
 	echo "Unknown source type: $2"
 	exit 1
     fi
-    if [ "x$line" == "x" ]; then
+    if [ "x$line" = "x" ]; then
 	break;
     fi
     _tmpsed=`mktemp gengir.XXXXXXXX`
-    echo "/${_ns}_[a-z].*_t/{s/.*\(${_ns}_[a-z].*_t\)[^a-z]*/\1/;p}" > $_tmpsed
+    printf "/${_ns}_[a-z].*_t/{s/.*\(${_ns}_[a-z].*_t\)[^a-z]*/\\\1/;p}\n" > $_tmpsed
     _n=1
     while [ 1 ]; do
 	_ll=`echo $line|sed -e 's/[ \t]*//'|cut -d' ' -f$_n`