Gentoo Archives: gentoo-dev

From: Ulrich Mueller <ulm@g.o>
To: gentoo-dev@l.g.o
Cc: python@g.o
Subject: Re: [gentoo-dev] [New eclass] twisted-r1.eclass
Date: Sat, 03 Aug 2013 15:54:54
Message-Id: 20989.10178.719868.528622@a1i15.kph.uni-mainz.de
In Reply to: [gentoo-dev] [New eclass] twisted-r1.eclass by "Michał Górny"
1 >>>>> On Sat, 3 Aug 2013, Micha³ Górny wrote:
2
3 > 2. The eclass comes with a pure bash-3.2 CamelCase converter for
4 > changing PNs like 'twisted-foo' into 'TwistedFoo'. The relevant code
5 > can be moved to eutils as portable replacements for bash-4 ${foo^}
6 > and friends.
7
8 > # obtain octal ASCII code for the first letter.
9 > local ord=$(printf '%o' "'${fl}")
10 >
11 > # check if it's [a-z]. ASCII codes are locale-safe.
12 > if [[ ${ord} -ge 141 && ${ord} -le 172 ]]; then
13 > # now substract 040 to make it upper-case.
14 > # fun fact: in range 0141..0172, decimal '- 40' is fine.
15 > local ord=$(( ${ord} - 40))
16 > # and convert it back to the character.
17 > fl=$(printf '\'${ord})
18 > fi
19
20 This looks just horrible. You do decimal arithmetic on octal numbers?
21
22 Ulrich

Replies

Subject Author
Re: [gentoo-dev] [New eclass] twisted-r1.eclass "Michał Górny" <mgorny@g.o>