|
Lines 1-54
Link Here
|
| 1 |
--- build-utils/gperf.sh.orig |
|
|
| 2 |
+++ build-utils/gperf.sh |
| 3 |
@@ -1,4 +1,4 @@ |
| 4 |
-#! /bin/sh -e |
| 5 |
+#!/bin/sh |
| 6 |
# |
| 7 |
# Copyright © 2008 Pierre Habouzit <madcoder@debian.org> |
| 8 |
# |
| 9 |
@@ -50,7 +50,7 @@ do_h() { |
| 10 |
|
| 11 |
typedef enum awesome_token_t { |
| 12 |
A_TK_UNKNOWN, |
| 13 |
-`tr 'a-z-./ ' 'A-Z____' | sed -e "s/^[^/].*/ A_TK_&,/"` |
| 14 |
+`tr '[:lower:]' '[:upper:]' | sed -e "s/^[^/].*/ A_TK_&,/"` |
| 15 |
} awesome_token_t; |
| 16 |
|
| 17 |
__attribute__((pure)) enum awesome_token_t a_tokenize(const char *s, int len); |
| 18 |
@@ -63,20 +63,21 @@ do_tokens() { |
| 19 |
case "$tok" in |
| 20 |
"") continue;; |
| 21 |
*) |
| 22 |
- echo "$tok, A_TK_`echo $tok | tr 'a-z-./ ' 'A-Z____'`" |
| 23 |
+ echo "$tok, A_TK_`echo $tok | tr '[:lower:]' '[:upper:]'`" |
| 24 |
;; |
| 25 |
esac |
| 26 |
done |
| 27 |
} |
| 28 |
|
| 29 |
do_c() { |
| 30 |
- if ! which gperf > /dev/null; then |
| 31 |
+ which gperf > /dev/null |
| 32 |
+ if test $? = 1 ; then |
| 33 |
echo "gperf not found. You need to install gperf." > /dev/stderr; |
| 34 |
exit 1; |
| 35 |
fi; |
| 36 |
|
| 37 |
- cat <<EOF | gperf -l -t -C -F",0" \ |
| 38 |
- --language=ANSI-C -Na_tokenize_aux \ |
| 39 |
+ gperf -l -t -C -F",0" \ |
| 40 |
+ --language=ANSI-C -Na_tokenize_aux <<EOF \ |
| 41 |
| sed -e '/__gnu_inline__/d;s/\<\(__\|\)inline\>//g' |
| 42 |
%{ |
| 43 |
`do_hdr` |
| 44 |
@@ -119,8 +120,8 @@ trap "rm -f ${TARGET}" 0 |
| 45 |
|
| 46 |
rm -f "${TARGET}" |
| 47 |
case "${TARGET}" in |
| 48 |
- *.h) cat "${TOKENS_FILE}" | do_h > "${TARGET}";; |
| 49 |
- *.c) cat "${TOKENS_FILE}" | do_c > "${TARGET}";; |
| 50 |
+ *.h) do_h > "${TARGET}" < "${TOKENS_FILE}" ;; |
| 51 |
+ *.c) do_c > "${TARGET}" < "${TOKENS_FILE}" ;; |
| 52 |
*) die "you must ask for the 'h' or 'c' generation";; |
| 53 |
esac |
| 54 |
chmod -w "${TARGET}" |