Commit | Line | Data |
---|---|---|
d8875586 MBT |
1 | ?RCS: $Id: spitshell.U 1 2006-08-24 12:32:52Z rmanfredi $ |
2 | ?RCS: | |
3 | ?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi | |
4 | ?RCS: | |
5 | ?RCS: You may redistribute only under the terms of the Artistic Licence, | |
6 | ?RCS: as specified in the README file that comes with the distribution. | |
7 | ?RCS: You may reuse parts of this distribution only within the terms of | |
8 | ?RCS: that same Artistic Licence; a copy of which may be found at the root | |
9 | ?RCS: of the source tree for dist 4.0. | |
10 | ?RCS: | |
11 | ?RCS: $Log: spitshell.U,v $ | |
12 | ?RCS: Revision 3.0.1.4 1997/02/28 16:22:12 ram | |
13 | ?RCS: patch61: removed useless chatter as this is now done very early | |
14 | ?RCS: | |
15 | ?RCS: Revision 3.0.1.3 1995/01/11 15:37:01 ram | |
16 | ?RCS: patch45: use 'test -f' instead of 'test -r' for exec-only cat progs (WED) | |
17 | ?RCS: patch45: protected "sh -c" within backquotes for Linux and SGI | |
18 | ?RCS: | |
19 | ?RCS: Revision 3.0.1.2 1994/08/29 16:33:00 ram | |
20 | ?RCS: patch32: don't create spitshell under the UU directory | |
21 | ?RCS: patch32: allow for cat in /bin or /usr/bin | |
22 | ?RCS: | |
23 | ?RCS: Revision 3.0.1.1 1993/09/13 16:12:58 ram | |
24 | ?RCS: patch10: made #!-failure message more friendly (WAD) | |
25 | ?RCS: | |
26 | ?RCS: Revision 3.0 1993/08/18 12:09:49 ram | |
27 | ?RCS: Baseline for dist 3.0 netwide release. | |
28 | ?RCS: | |
29 | ?MAKE:spitshell shsharp sharpbang: eunicefix sh Head | |
30 | ?MAKE: -pick add $@ %< | |
31 | ?S:spitshell: | |
32 | ?S: This variable contains the command necessary to spit out a runnable | |
33 | ?S: shell on this system. It is either cat or a grep -v for # comments. | |
34 | ?S:. | |
35 | ?S:shsharp: | |
36 | ?S: This variable tells further Configure units whether your sh can | |
37 | ?S: handle # comments. | |
38 | ?S:. | |
39 | ?S:sharpbang: | |
40 | ?S: This variable contains the string #! if this system supports that | |
41 | ?S: construct. | |
42 | ?S:. | |
43 | ?F:!sharp | |
44 | ?T:xcat p | |
45 | ?X: "paths" comes from Head | |
46 | ?LINT:extern paths _exe | |
47 | : see if sh knows # comments | |
48 | ?X: This is loaded up early, so avoid being chatty. | |
49 | ?X: echo " " | |
50 | ?X: echo "Checking your $sh to see if it knows about # comments..." >&2 | |
51 | if `$sh -c '#' >/dev/null 2>&1`; then | |
52 | ?X: echo "Your $sh handles # comments correctly." | |
53 | shsharp=true | |
54 | spitshell=cat | |
55 | ?X: echo " " | |
56 | ?X: echo "Okay, let's see if #! works on this system..." | |
57 | xcat=/bin/cat | |
58 | test -f $xcat$_exe || xcat=/usr/bin/cat | |
59 | if test ! -f $xcat$_exe; then | |
60 | for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do | |
61 | if test -f $p/cat$_exe; then | |
62 | xcat=$p/cat | |
63 | break | |
64 | fi | |
65 | done | |
66 | if test ! -f $xcat$_exe; then | |
67 | echo "Can't find cat anywhere!" | |
68 | exit 1 | |
69 | fi | |
70 | fi | |
71 | echo "#!$xcat" >sharp | |
72 | $eunicefix sharp | |
73 | chmod +x sharp | |
74 | ./sharp > today 2>/dev/null | |
75 | if test -s today; then | |
76 | ?X: echo "It does." | |
77 | sharpbang='#!' | |
78 | else | |
79 | echo "#! $xcat" > sharp | |
80 | $eunicefix sharp | |
81 | chmod +x sharp | |
82 | ./sharp > today 2>/dev/null | |
83 | if test -s today; then | |
84 | ?X: echo "It does." | |
85 | sharpbang='#! ' | |
86 | else | |
87 | ?X: echo "Okay, let's see if #! works on this system..." | |
88 | ?X: echo "It's just a comment." | |
89 | sharpbang=': use ' | |
90 | fi | |
91 | fi | |
92 | else | |
93 | echo " " | |
94 | echo "Your $sh doesn't grok # comments--I will strip them later on." | |
95 | shsharp=false | |
96 | ?X: The spitshell script will be perused, so leave it out the UU directory | |
97 | cd .. | |
98 | echo "exec grep -v '^[ ]*#'" >spitshell | |
99 | chmod +x spitshell | |
100 | $eunicefix spitshell | |
101 | spitshell=`pwd`/spitshell | |
102 | cd UU | |
103 | echo "I presume that if # doesn't work, #! won't work either!" | |
104 | sharpbang=': use ' | |
105 | fi | |
106 | rm -f sharp today | |
107 |