+/*
+ * Extract a dentry to standard output.
+ *
+ * This obviously doesn't make sense in all cases. We return an error if the
+ * dentry does not correspond to a regular file. Otherwise we extract the
+ * unnamed data stream only.
+ */
+static int
+extract_dentry_to_stdout(struct wim_dentry *dentry)
+{
+ int ret = 0;
+ if (!dentry_is_regular_file(dentry)) {
+ ERROR("\"%"TS"\" is not a regular file and therefore cannot be "
+ "extracted to standard output", dentry->_full_path);
+ ret = WIMLIB_ERR_NOT_A_REGULAR_FILE;
+ } else {
+ struct wim_lookup_table_entry *lte;
+
+ lte = inode_unnamed_lte_resolved(dentry->d_inode);
+ if (lte) {
+ ret = extract_wim_resource_to_fd(lte, STDOUT_FILENO,
+ wim_resource_size(lte));
+ }
+ }
+ return ret;
+}
+