On Tue, Dec 15, 2009 at 2:27 AM, Kjell Claesson
<[email protected]> wrote:

> So setting the length of the answer from the ID_block. So from 0 - 20 at the 
> moment.
> It would be possible to hardcode this len, and leave some space for 4 outlet.
>
> Would be 2+6+6+6+6 = 26

If you do hardcode it, be sure to use something like fatalx() to
indicate whether there are more outlets than the code can handle. This
sounds unlikely, but it could happen if there is an error parsing
something earlier on.

Otherwise, as Arjen suggested, you could allocate it dynamically. The
xmalloc() function in common/common.c does out-of-memory checking for
you.

-- 
- Charles Lepple

_______________________________________________
Nut-upsdev mailing list
[email protected]
http://lists.alioth.debian.org/mailman/listinfo/nut-upsdev

Reply via email to