* xmlShellList: * @ctxt: the shell context * @arg: unused * @node: a node * @node2: unused * * Implements the XML shell function "ls" * Does an Unix like listing of the given node (like a directory) * * Returns 0 */
| 1984 | * Returns 0 |
| 1985 | */ |
| 1986 | int |
| 1987 | xmlShellList(xmlShellCtxtPtr ctxt, |
| 1988 | char *arg ATTRIBUTE_UNUSED, xmlNodePtr node, |
| 1989 | xmlNodePtr node2 ATTRIBUTE_UNUSED) |
| 1990 | { |
| 1991 | xmlNodePtr cur; |
| 1992 | if (!ctxt) |
| 1993 | return (0); |
| 1994 | if (node == NULL) { |
| 1995 | fprintf(ctxt->output, "NULL\n"); |
| 1996 | return (0); |
| 1997 | } |
| 1998 | if ((node->type == XML_DOCUMENT_NODE) || |
| 1999 | (node->type == XML_HTML_DOCUMENT_NODE)) { |
| 2000 | cur = ((xmlDocPtr) node)->children; |
| 2001 | } else if (node->type == XML_NAMESPACE_DECL) { |
| 2002 | xmlLsOneNode(ctxt->output, node); |
| 2003 | return (0); |
| 2004 | } else if (node->children != NULL) { |
| 2005 | cur = node->children; |
| 2006 | } else { |
| 2007 | xmlLsOneNode(ctxt->output, node); |
| 2008 | return (0); |
| 2009 | } |
| 2010 | while (cur != NULL) { |
| 2011 | xmlLsOneNode(ctxt->output, cur); |
| 2012 | cur = cur->next; |
| 2013 | } |
| 2014 | return (0); |
| 2015 | } |
| 2016 | |
| 2017 | /** |
| 2018 | * xmlShellBase: |
no test coverage detected