[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



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

Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.