[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] [PATCH v6] acpi: Prevent GPL-only code from seeping into non-GPL binaries
On 09/26/2016 10:45 AM, Ian Jackson wrote: > Boris Ostrovsky writes ("Re: [PATCH v6] acpi: Prevent GPL-only code from > seeping into non-GPL binaries"): >> There are two interdependent variables that I need to print. The C >> equivalent is >> >> for ( i = 0; i < 4; i++ ) >> printf("%d %c\n", i, 'A'+i); >> >> The character value is derived from 'i', which in this example is an >> index into 'links' array. >> >> I suggested in response to Jan >> >> link=`echo "A B C D" | cut -d" " -f $i` > If the indices are necessarily successive integers: > > links="A B C D" > index=0 > for link in $links; do > index=$(( $index + 1 )) > something with $link and $index > > If the indices are arbitrary: > > links="1:A 4:B 7:C 10:D" > for linkinfo in $links; do > link=${linkinfo#*:} > index=${linkinfo%%:*} > something with $link and $index The indices are not successive, in one case they are a function of two enclosing loop indices, such as for dev in $(seq 1 31) do for intx in $(seq 0 3) do link_idx=$(((dev + intx) & 3)) printf " Package(){0x%04xffff, %u, \\\\_SB.PCI0.LNK%c, 0},\n" \ $dev $intx ${links:$link_idx:1} done done (And then there might also be a question of portability with the second approach?) So if you don't object to link=`echo "A B C D" | cut -d" " -f $i` I'd rather go with that. (I'll add '#!/bin/sh' as you requested in another email) -boris _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx https://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |