+#include "optgroups.h"
+
+int
+optgroup_xz_available (void)
+{
+ return prog_exists ("xz");
+}
+
+/* Redirect errors from the tar command to the error file, then
+ * provide functions for reading it in. We overwrite the file each
+ * time, and since it's small and stored on the appliance we don't
+ * bother to delete it.
+ */
+static const char *error_file = "/tmp/error";
+
+static char *
+read_error_file (void)
+{
+ size_t len;
+ char *str = read_file (error_file, &len);
+ if (str == NULL) {
+ str = strdup ("(no error)");
+ if (str == NULL) {
+ perror ("strdup");
+ exit (EXIT_FAILURE);
+ }
+ len = strlen (str);
+ }
+
+ /* Remove trailing \n character if any. */
+ if (len > 0 && str[len-1] == '\n')
+ str[--len] = '\0';
+
+ return str; /* caller frees */
+}