-sed \
- -e '/for Library_Options use /s,-- ,'"$SHARE"',' \
- -e '/for Default_Switches ("C") use/s,-- ,,' \
- -e '/for Default_Switches ("C") use/s% use .*'%" use($param);"% \
- $input
-exit 0
+SCRIPT=library-cfg.tmp
+cat >$SCRIPT <<EOF
+/for Library_Options use /{
+ s,-- ,$SHARE,
+}
+/for Default_Switches ("C") use/{
+ s,-- ,,
+ s% use .*% use($param);%
+}
+EOF
+
+sed -f "$SCRIPT" "$input"
+rc=$?
+rm -f "$SCRIPT"
+exit $rc