Группа :: Разработка/Tcl
Пакет: expect
Главная Изменения Спек Патчи Sources Загрузить Gear Bugs and FR Repocop
Патч: expect-5.43-alt-fixline.patch
Скачать
Скачать
diff --git a/fixline1 b/fixline1
index 113e9bb..81e8a02 100755
--- a/fixline1
+++ b/fixline1
@@ -1,8 +1,10 @@
-#!expect --
+#!/usr/bin/tclsh
+# -*- tcl -*-
# 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 ...
@@ -10,16 +12,20 @@
#!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
- regexp "^#!(.*/)*(.*)" $line1 X X tail
- set header "#!/bin/sh\n"
- append header "# \\\n"
- append header "exec $tail "; append header {"$0" ${1+"$@"}}
+set line1 "#!/usr/bin/tclsh"
+set with_tk {}
+
+if {[regexp {^#!(?:.*/)*([^ ]+)} [gets stdin] {} interp]} {
+ switch -exact -- $interp {
+ expectk {
+ set with_tk {package require Tk}
+ }
+ expect {}
+ default {
+ error "FIXME: $interp"
+ }
+ }
}
-puts -nonewline "$header\n[read stdin]"
+
+puts -nonewline "$line1\npackage require Expect\n$with_tk\n[read stdin]"