Sisyphus repository
Last update: 1 october 2023 | SRPMs: 18631 | Visits: 37041014
en ru br
ALT Linux repos
S:5.45.4-alt4
5.0: 5.44-alt3
4.1: 5.44-alt2
4.0: 5.43-alt3
3.0: 5.43-alt1

Other repositories
Upstream:5.44.1

Group :: Development/Tcl
RPM: expect

 Main   Changelog   Spec   Patches   Sources   Download   Gear   Bugs and FR  Repocop 

Patch: avoid-using-fixline1-from-now.patch
Download


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]"
 
design & coding: Vladimir Lettiev aka crux © 2004-2005, Andrew Avramenko aka liks © 2007-2008
current maintainer: Michael Shigorin