+static void
+run_decompress_program (void)
+{
+ int i;
+ const char *p, *prog = NULL;
+ struct wordsplit ws;
+ int wsflags = (WRDSF_DEFFLAGS | WRDSF_ENV | WRDSF_DOOFFS) & ~WRDSF_NOVAR;
+
+ ws.ws_env = (const char **) environ;
+ ws.ws_offs = 1;
+
+ for (p = first_decompress_program (&i); p; p = next_decompress_program (&i))
+ {
+ if (prog)
+ {
+ WARNOPT (WARN_DECOMPRESS_PROGRAM,
+ (0, errno, _("cannot run %s"), prog));
+ WARNOPT (WARN_DECOMPRESS_PROGRAM,
+ (0, 0, _("trying %s"), p));
+ }
+ if (wordsplit (p, &ws, wsflags))
+ FATAL_ERROR ((0, 0, _("cannot split string '%s': %s"),
+ p, wordsplit_strerror (&ws)));
+ wsflags |= WRDSF_REUSE;
+ memmove(ws.ws_wordv, ws.ws_wordv + ws.ws_offs,
+ sizeof(ws.ws_wordv[0])*ws.ws_wordc);
+ ws.ws_wordv[ws.ws_wordc] = (char *) "-d";
+ prog = p;
+ execvp (ws.ws_wordv[0], ws.ws_wordv);
+ ws.ws_wordv[ws.ws_wordc] = NULL;
+ }
+ if (!prog)
+ FATAL_ERROR ((0, 0, _("unable to run decompression program")));
+ exec_fatal (prog);
+}
+