Moved write_ndx_and_attrs() to sender.c and made it public.