+#include "optgroups.h"
+
+int
+optgroup_xz_available (void)
+{
+ return prog_exists ("xz");
+}
+
+/* Read the error file. Returns a string that the caller must free. */
+static char *
+read_error_file (char *error_file)
+{
+ size_t len;
+ char *str;
+
+ 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 */
+}