]> git.ozlabs.org Git - ccan/blobdiff - tools/configurator/configurator.c
configurator: Use native directory separator
[ccan] / tools / configurator / configurator.c
index 5d959cf33c6b04bdad29c8df6fb3d5f7e77874bc..0252fc1ce8901992649cf8a80ffcaf6684bf153f 100644 (file)
 #define OUTPUT_FILE "configurator.out"
 #define INPUT_FILE "configuratortest.c"
 
+#ifdef _WIN32
+#define DIR_SEP   "\\"
+#else
+#define DIR_SEP   "/"
+#endif
+
 static int verbose;
 
 enum test_style {
@@ -330,7 +336,7 @@ static struct test tests[] = {
          "     setcontext(&b);\n"
          "     x |= 4;\n"
          "}\n"
-         "int main(int argc, char *argv[]) {\n"
+         "int main(void) {\n"
          "     x |= 1;\n"
          "     getcontext(&a);\n"
          "     a.uc_stack.ss_sp = stack;\n"
@@ -354,7 +360,7 @@ static struct test tests[] = {
          "             worked = 1;\n"
          "     setcontext(&b);\n"
          "}\n"
-         "int main(int argc, char *argv[]) {\n"
+         "int main(void) {\n"
          "     void *ap = &worked;\n"
          "     void *aq = (void *)(~((ptrdiff_t)ap));\n"
          "     getcontext(&a);\n"
@@ -585,7 +591,7 @@ static bool run_test(const char *cmd, struct test *test)
                free(output);
                /* We run INSIDE_MAIN tests for sanity checking. */
                if ((test->style & EXECUTE) || (test->style & INSIDE_MAIN)) {
-                       output = run("./" OUTPUT_FILE, &status);
+                       output = run("." DIR_SEP OUTPUT_FILE, &status);
                        if (!(test->style & EXECUTE) && status != 0)
                                errx(1, "Test for %s failed with %i:\n%s",
                                     test->name, status, output);
@@ -639,8 +645,8 @@ int main(int argc, const char *argv[])
                run_test(cmd, &tests[i]);
        free(cmd);
 
-       unlink(OUTPUT_FILE);
-       unlink(INPUT_FILE);
+       remove(OUTPUT_FILE);
+       remove(INPUT_FILE);
 
        printf("/* Generated by CCAN configurator */\n"
               "#ifndef CCAN_CONFIG_H\n"