[Swan-dev] sed -e 's/u_int\([^0-9]\)/unsigned\1/g'

Andrew Cagney andrew.cagney at gmail.com
Thu Sep 6 14:03:48 UTC 2018


On Wed, 5 Sep 2018 at 23:54, D. Hugh Redelmeier <hugh at mimosa.com> wrote:
>
>
> | commit 8ae190998e1aa32aa8903d541b7c0365934d4735
> | Author: Andrew Cagney <andrew.cagney at gmail.com>
> | Date:   Wed Sep 5 17:16:17 2018 -0400
> |
> |     bsd: sed -i -e 's/u_int\([0-9]*\)_t/uint\1_t/g' -e 's/u_int\([^0-9]\)/unsigned\1/g'
>
> The pattern /\<u_int\>/ is more reliable and easier.  I'd recommend
> this:
>
>   sed -i -e 's/\<u_int\([0-9]*\)_t\>/uint\1_t/g' -e 's/\<u_int\>/unsigned/g'

It looks like a gnu extension, or something new to POSIX?

charlie$ cat /tmp/x
au_int8_t
a u_int8_t
<u_int8_t>
charlie$ sed -e 's/\<u_int\([0-9]*\)_t\>/uint\1_t/g' -e
's/\<u_int\>/unsigned/g' < /tmp/x
au_int8_t
a u_int8_t
uint8_t

however, definitely useful.

> I don't imagine that there actually were problems created by the
> original formulation.

I'm not sure what to do with programs/pluto/.  I know there are some
pending patches and I'd rather not touch it until then.

I also checked the kernel sources since pluto should look like kernel
code, and u_int*_t is definitely on the way out:

[cagney at bernard linux]$ find * -type f -print | xargs grep
'\<u_int[0-9]*_t\>' | wc -l
837
[cagney at bernard linux]$ find * -type f -print | xargs grep
'\<uint[0-9]*_t\>' | wc -l
100494

Since I'm there:

[cagney at bernard linux]$ find * -type f -print | xargs grep -e
'\<TRUE\>' -e '\<FALSE\>' | wc -l
2231
[cagney at bernard linux]$ find * -type f -print | xargs grep -e
'\<true\>' -e '\<false\>' | wc -l
109175

and in both cases, the uses seem to be largely confined to machine
dependent bits (and a surprising number of comments).


More information about the Swan-dev mailing list