+static int
+execute_csharp_using_sscli (const char *assembly_path,
+ const char * const *libdirs,
+ unsigned int libdirs_count,
+ const char * const *args, unsigned int nargs,
+ bool verbose, bool quiet,
+ execute_fn *executer, void *private_data)
+{
+ static bool clix_tested;
+ static bool clix_present;
+
+ if (!clix_tested)
+ {
+ /* Test for presence of clix:
+ "clix >/dev/null 2>/dev/null ; test $? = 1" */
+ char *argv[2];
+ int exitstatus;
+
+ argv[0] = "clix";
+ argv[1] = NULL;
+ exitstatus = execute ("clix", "clix", argv, false, false, true, true,
+ true, false);
+ clix_present = (exitstatus == 0 || exitstatus == 1);
+ clix_tested = true;
+ }
+
+ if (clix_present)
+ {
+ char *old_clixpath;
+ char **argv = (char **) xallocsa ((2 + nargs + 1) * sizeof (char *));
+ unsigned int i;
+ bool err;
+
+ /* Set clix' PATH variable. */
+ old_clixpath = set_clixpath (libdirs, libdirs_count, false, verbose);
+
+ argv[0] = "clix";
+ argv[1] = (char *) assembly_path;
+ for (i = 0; i <= nargs; i++)
+ argv[2 + i] = (char *) args[i];
+
+ if (verbose)
+ {
+ char *command = shell_quote_argv (argv);
+ printf ("%s\n", command);
+ free (command);
+ }
+
+ err = executer ("clix", "clix", argv, private_data);
+
+ /* Reset clix' PATH variable. */
+ reset_clixpath (old_clixpath);
+
+ freesa (argv);
+
+ return err;
+ }
+ else
+ return -1;
+}
+