Группа :: Разработка/Tcl
Пакет: expect
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: avoid-using-fixline1-from-now.patch
Скачать
Скачать
diff --git a/Makefile.in b/Makefile.in
index f726d2a..7f7f33b 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -380,7 +380,7 @@ dist: dist-clean doc
cp $(DIST_ROOT)/$(PKG_DIR).tar.gz $(top_builddir)
$(SCRIPTS):
- $(TCLSH) $(srcdir)/fixline1 $(SHORT_BINDIR) < $(srcdir)/example/$@ > $@
+ @cp -pf $(srcdir)/example/$@ $@
## We cannot use TCL_LIBS below (after TCL_LIB_SPEC) because its
## expansion references the contents of LIBS, which contains linker
diff --git a/fixline1 b/fixline1
index a61e156..113e9bb 100755
--- a/fixline1
+++ b/fixline1
@@ -1,10 +1,8 @@
-#!/usr/bin/tclsh
-# -*- tcl -*-
+#!expect --
# Synopsis: fixline1 newpath < input > output
# Author: Don Libes
-# Modified by: Sergey Bolshakov <sbolshakov@altlinux.ru>
-# Description: change first line of script to load expect as tcl package
+# Description: change first line of script to reflect new binary
# try to match any of the following first lines
#!expect ...
#!../expect ...
@@ -12,22 +10,16 @@
#!foo/bar/expectk ...
#!/bin/sh ... (beginning of multiline #! style)
#
+set line1 [gets stdin]
+if {"$line1" == "\#!/bin/sh"} {
+ # if multi-line hack already in place, do nothing
+ set header $line1
+} else {
+ # if single-line #!, switch to multi-line rewrite
-set line1 "#!/usr/bin/tclsh"
-set with_tk {}
-
-if {[regexp {^#!(?:.*/)*([^ ]+)} [gets stdin] {} interp]} {
- switch -exact -- $interp {
- expectk {
- set with_tk {package require Tk}
- }
- expect {}
- tclsh { exit 0 }
- sh { exit 0 }
- default {
- error "FIXME: $interp"
- }
- }
+ regexp "^#!(.*/)*(.*)" $line1 X X tail
+ set header "#!/bin/sh\n"
+ append header "# \\\n"
+ append header "exec $tail "; append header {"$0" ${1+"$@"}}
}
-
-puts -nonewline "$line1\npackage require Expect\n$with_tk\n[read stdin]"
+puts -nonewline "$header\n[read stdin]"