+ name_fill_directory (name, device, cmdline);
+ buffer = directory_contents (name->directory);
+ if (buffer)
+ {
+ struct name *child_head = NULL, *child_tail = NULL;
+ size_t name_length = name->length;
+ size_t allocated_length = (name_length >= NAME_FIELD_SIZE
+ ? name_length + NAME_FIELD_SIZE
+ : NAME_FIELD_SIZE);
+ char *namebuf = xmalloc (allocated_length + 1);
+ /* FIXME: + 2 above? */
+ const char *string;
+ size_t string_length;
+ int change_dir = name->change_dir;
+
+ strcpy (namebuf, name->name);
+ if (! ISSLASH (namebuf[name_length - 1]))
+ {
+ namebuf[name_length++] = '/';
+ namebuf[name_length] = '\0';
+ }
+
+ for (string = buffer; *string; string += string_length + 1)
+ {
+ string_length = strlen (string);
+ if (*string == 'D')
+ {
+ struct name *np;
+
+ if (allocated_length <= name_length + string_length)
+ {
+ do
+ {
+ allocated_length *= 2;
+ if (! allocated_length)
+ xalloc_die ();
+ }
+ while (allocated_length <= name_length + string_length);
+
+ namebuf = xrealloc (namebuf, allocated_length + 1);
+ }
+ strcpy (namebuf + name_length, string + 1);
+ np = addname (namebuf, change_dir, false, name);
+ if (!child_head)
+ child_head = np;
+ else
+ child_tail->sibling = np;
+ child_tail = np;
+ add_hierarchy_to_namelist (np, device, false);
+ }
+ }
+
+ free (namebuf);
+ name->child = child_head;
+ }