swh:1:snp:3cba5856b0ddc3feab6c3c2d096d614b02c883ec
Raw File
Tip revision: 3b7f19a72ff2216b4613fdc8c5edf5d56e74d6fc authored by Brad King on 24 March 2017, 12:47:13 UTC
CMake 3.8.0-rc3
Tip revision: 3b7f19a
check_command_line.c.in
#include <stdio.h>
#include <string.h>

const char* expected_arguments[] =
{
@EXPECTED_ARGUMENTS@  0
};

int main(int argc, const char* argv[])
{
  const char** a = argv+1;
  const char** e = expected_arguments;
  (void)argc;
  for(;*a && *e; ++a, ++e)
    {
    if(strcmp(*a, *e) != 0)
      {
      fprintf(stderr, "Argument [%s] does not match expected [%s].\n",
              *a, *e);
      return 1;
      }
    else
      {
#if defined(CHECK_COMMAND_LINE_VERBOSE)
      printf("[%s]\n", *a);
#endif
      }
    }
  if(*a || *e)
    {
    fprintf(stderr, "Number of arguments does not match expected.\n");
    return 1;
    }
  printf("Command line escapes work!\n");
  return 0;
}
back to top