summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch')
-rw-r--r--meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch160
1 files changed, 160 insertions, 0 deletions
diff --git a/meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch b/meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch
new file mode 100644
index 0000000000..c173ae2f84
--- /dev/null
+++ b/meta/recipes-core/eglibc/eglibc-2.16/tzselect-sh.patch
@@ -0,0 +1,160 @@
1tzselect: eliminate ksh-dependency
2
3This is an adapted version of a patch originally
4by Peter Seebach <peter.seebach@windriver.com> found here:
5http://www.eglibc.org/archives/patches/msg00671.html
6
7Upstream-Status: Pending
8
9Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
10
11--- libc/timezone/tzselect.ksh
12+++ libc/timezone/tzselect.ksh
13@@ -1,6 +1,6 @@
14-#! @KSH@
15+#!/bin/sh
16
17-VERSION='@(#)tzselect.ksh 8.2'
18+VERSION='@(#)tzselect.sh 8.2'
19 PKGVERSION='@PKGVERSION@'
20 REPORT_BUGS_TO='@REPORT_BUGS_TO@'
21
22@@ -11,19 +11,10 @@ REPORT_BUGS_TO='@REPORT_BUGS_TO@'
23
24 # Porting notes:
25 #
26-# This script requires several features of the Korn shell.
27-# If your host lacks the Korn shell,
28-# you can use either of the following free programs instead:
29+# func_select allows this script to run on shells (such as busybox ash)
30+# which lack the ksh "select" builtin.
31 #
32-# <a href=ftp://ftp.gnu.org/pub/gnu/>
33-# Bourne-Again shell (bash)
34-# </a>
35-#
36-# <a href=ftp://ftp.cs.mun.ca/pub/pdksh/pdksh.tar.gz>
37-# Public domain ksh
38-# </a>
39-#
40-# This script also uses several features of modern awk programs.
41+# This script uses several features of modern awk programs.
42 # If your host lacks awk, or has an old awk that does not conform to Posix.2,
43 # you can use either of the following free programs instead:
44 #
45@@ -35,6 +26,70 @@ REPORT_BUGS_TO='@REPORT_BUGS_TO@'
46 # mawk
47 # </a>
48
49+# Implement ksh-style select in POSIX shell
50+
51+# We need a mostly-portable echo-n.
52+case `echo -n "foo\c"` in
53+*n*c*) func_echo_n() { echo "$*"; } ;;
54+*n*) func_echo_n() { echo "$*\c"; } ;;
55+*) func_echo_n() { echo -n "$*"; } ;;
56+esac
57+
58+# Synopsis: Replace "select foo in list" with "while func_select foo in list"
59+# and this works just like ksh, so far as I know.
60+func_select () {
61+ func_select_args=0
62+ if expr "$1" : "[_a-zA-Z][_a-zA-Z0-9]*$" > /dev/null; then
63+ func_select_var=$1
64+ else
65+ echo >&2 "func_select: '$1' is not a valid variable name."
66+ return 1
67+ fi
68+ shift 1
69+ case $1 in
70+ in) shift 1;;
71+ *) echo >&2 "func_select: usage: func_select var in ... (you must provide
72+arguments)"; return 1;;
73+ esac
74+ case $# in
75+ 0) echo >&2 "func_select: usage: func_select var in ..."; return 1;;
76+ esac
77+ for func_select_arg
78+ do
79+ func_select_args=`expr $func_select_args + 1`
80+ eval func_select_a_$func_select_args=\$func_select_arg
81+ done
82+ REPLY=""
83+ while :
84+ do
85+ if test -z "$REPLY"; then
86+ func_select_i=1
87+ while test $func_select_i -le $func_select_args
88+ do
89+ eval echo "\"\$func_select_i) \$func_select_a_$func_select_i\""
90+ func_select_i=`expr $func_select_i + 1`
91+ done
92+ fi
93+ func_echo_n "${PS3-#? }" >&2
94+ if read REPLY; then
95+ if test -n "${REPLY}"; then
96+ if expr "$REPLY" : '[1-9][0-9]*$' > /dev/null; then
97+ if test "$REPLY" -ge 1 && test "$REPLY" -le $func_select_args; then
98+ eval $func_select_var=\$func_select_a_$REPLY
99+ else
100+ eval $func_select_var=
101+ fi
102+ else
103+ eval $func_select_var=
104+ fi
105+ return 0
106+ fi
107+ else
108+ eval $func_select_var=
109+ return 1
110+ fi
111+ done
112+}
113
114 # Specify default values for environment variables if they are unset.
115 : ${AWK=awk}
116@@ -80,7 +135,7 @@ IFS=$newline
117
118
119 # Work around a bug in bash 1.14.7 and earlier, where $PS3 is sent to stdout.
120-case $(echo 1 | (select x in x; do break; done) 2>/dev/null) in
121+case $(echo 1 | (while func_select x in x; do break; done) 2>/dev/null) in
122 ?*) PS3=
123 esac
124
125@@ -100,7 +155,7 @@ while
126
127 echo >&2 'Please select a continent or ocean.'
128
129- select continent in \
130+ while func_select continent in \
131 Africa \
132 Americas \
133 Antarctica \
134@@ -180,7 +235,7 @@ while
135 case $countries in
136 *"$newline"*)
137 echo >&2 'Please select a country.'
138- select country in $countries
139+ while func_select country in $countries
140 do
141 case $country in
142 '') echo >&2 'Please enter a number in range.';;
143@@ -219,7 +274,7 @@ while
144 *"$newline"*)
145 echo >&2 'Please select one of the following' \
146 'time zone regions.'
147- select region in $regions
148+ while func_select region in $regions
149 do
150 case $region in
151 '') echo >&2 'Please enter a number in range.';;
152@@ -296,7 +351,7 @@ Universal Time is now: $UTdate."
153 echo >&2 "Is the above information OK?"
154
155 ok=
156- select ok in Yes No
157+ while func_select ok in Yes No
158 do
159 case $ok in
160 '') echo >&2 'Please enter 1 for Yes, or 2 for No.';;