-/*
- * The `Nm' macro sets the document's name when used the first time with
- * an argument. Subsequent calls without a value will result in the
- * name value being used.
- */
+static int
+post_ex(struct mdoc *mdoc)
+{
+
+ /*
+ * If `.Ex -std' is invoked without an argument, fill it in with
+ * our name (if it's been set).
+ */
+
+ if (0 == mdoc->last->data.elem.argc)
+ return(1);
+
+ assert(1 == mdoc->last->data.elem.argc);
+ if (1 == mdoc->last->data.elem.argv[0].sz)
+ return(1);
+ assert(0 == mdoc->last->data.elem.argv[0].sz);
+
+ if (NULL == mdoc->meta.name)
+ return(mdoc_err(mdoc, "default name not yet set"));
+
+ mdoc_msg(mdoc, "writing %s argument: %s",
+ mdoc_argnames[MDOC_Std], mdoc->meta.name);
+
+ mdoc->last->data.elem.argv[0].sz = 1;
+ mdoc->last->data.elem.argv[0].value = xcalloc(1, sizeof(char *));
+ mdoc->last->data.elem.argv[0].value[0] = xstrdup(mdoc->meta.name);
+ return(1);
+}
+
+