X-Git-Url: https://git.ozlabs.org/?p=ccan;a=blobdiff_plain;f=tools%2Fconfigurator%2Fconfigurator.c;h=5ba8cb0bb0c780a54849a8137187d22b647a62da;hp=143069074ff4c74d222c8a48df061daf9b5d0794;hb=7471ecd79174306ee976a4ecc09cc2b9ebb4b501;hpb=1322fd3377cc817720f7552a80d56dba447bcfea diff --git a/tools/configurator/configurator.c b/tools/configurator/configurator.c index 14306907..5ba8cb0b 100644 --- a/tools/configurator/configurator.c +++ b/tools/configurator/configurator.c @@ -249,6 +249,8 @@ static struct test tests[] = { "return ({ int x = argc; x == argc ? 0 : 1; });" }, { "HAVE_SYS_FILIO_H", OUTSIDE_MAIN, NULL, NULL, /* Solaris needs this for FIONREAD */ "#include \n" }, + { "HAVE_SYS_TERMIOS_H", OUTSIDE_MAIN, NULL, NULL, + "#include \n" }, { "HAVE_TYPEOF", INSIDE_MAIN, NULL, NULL, "__typeof__(argc) i; i = argc; return i == argc ? 0 : 1;" }, { "HAVE_UTIME", DEFINES_FUNC, NULL, NULL, @@ -340,7 +342,8 @@ static char *connect_args(const char *argv[], const char *extra) for (i = 1; argv[i]; i++) { strcpy(ret + len, argv[i]); len += strlen(argv[i]); - ret[len++] = ' '; + if (argv[i+1]) + ret[len++] = ' '; } strcpy(ret + len, extra); return ret; @@ -506,14 +509,13 @@ int main(int argc, const char *argv[]) if (argc == 1) argv = default_args; - cmd = connect_args(argv, "-o " OUTPUT_FILE " " INPUT_FILE); + cmd = connect_args(argv, " -o " OUTPUT_FILE " " INPUT_FILE); for (i = 0; i < sizeof(tests)/sizeof(tests[0]); i++) run_test(cmd, &tests[i]); unlink(OUTPUT_FILE); unlink(INPUT_FILE); - cmd[strlen(cmd) - strlen(" -o " OUTPUT_FILE " " INPUT_FILE)] = '\0'; printf("/* Generated by CCAN configurator */\n" "#ifndef CCAN_CONFIG_H\n" "#define CCAN_CONFIG_H\n"); @@ -521,7 +523,7 @@ int main(int argc, const char *argv[]) printf("#define _GNU_SOURCE /* Always use GNU extensions. */\n"); printf("#endif\n"); printf("#define CCAN_COMPILER \"%s\"\n", argv[1]); - printf("#define CCAN_CFLAGS \"%s\"\n\n", cmd + strlen(argv[1]) + 1); + printf("#define CCAN_CFLAGS \"%s\"\n\n", connect_args(argv+1, "")); /* This one implies "#include