<arg choice="opt">--frozen</arg>
<arg choice="opt">--running</arg>
<arg choice="opt">--stopped</arg>
+ <arg choice="opt">--defined</arg>
<arg choice="opt">-f</arg>
<arg choice="opt">-F <replaceable>format</replaceable></arg>
<arg choice="opt">-g <replaceable>groups</replaceable></arg>
</listitem>
</varlistentry>
+ <varlistentry>
+ <term>
+ <option>--defined</option>
+ </term>
+ <listitem>
+ <para>
+ List only defined containers.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry>
<term>
<option>-f,--fancy</option>
#define LS_RUNNING 4
#define LS_NESTING 5
#define LS_FILTER 6
+#define LS_DEFINED 7
#ifndef SOCK_CLOEXEC
# define SOCK_CLOEXEC 02000000
{"running", no_argument, 0, LS_RUNNING},
{"frozen", no_argument, 0, LS_FROZEN},
{"stopped", no_argument, 0, LS_STOPPED},
+ {"defined", no_argument, 0, LS_DEFINED},
{"nesting", optional_argument, 0, LS_NESTING},
{"groups", required_argument, 0, 'g'},
{"filter", required_argument, 0, LS_FILTER},
--running list only running containers\n\
--frozen list only frozen containers\n\
--stopped list only stopped containers\n\
+ --defined list only defined containers\n\
--nesting=NUM list nested containers up to NUM (default is 5) levels of nesting\n\
--filter=REGEX filter container names by regular expression\n\
-g --groups comma separated list of groups a container must have to be displayed\n",
else if (!c)
continue;
- if (!c->is_defined(c))
+ if (args->ls_defined && !c->is_defined(c)){
goto put_and_next;
+ }
/* This does not allocate memory so no worries about freeing it
* when we goto next or out. */
case LS_STOPPED:
args->ls_stopped = true;
break;
+ case LS_DEFINED:
+ args->ls_defined = true;
+ break;
case LS_NESTING:
/* In case strtoul() receives a string that represents a
* negative number it will return ULONG_MAX - the number that