askfirst.c 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2013 Felix Fietkau <nbd@openwrt.org>
  3. * Copyright (C) 2013 John Crispin <blogic@openwrt.org>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU Lesser General Public License version 2.1
  7. * as published by the Free Software Foundation
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. */
  14. #include <sys/types.h>
  15. #include <sys/stat.h>
  16. #include <stdio.h>
  17. #include <unistd.h>
  18. #include <fcntl.h>
  19. int main(int argc, char **argv)
  20. {
  21. int c;
  22. printf("Please press Enter to activate this console.\n");
  23. do {
  24. c = getchar();
  25. if (c == EOF)
  26. return -1;
  27. }
  28. while (c != 0xA);
  29. if (argc < 2) {
  30. printf("%s needs to be called with at least 1 parameter\n", argv[0]);
  31. return -1;
  32. }
  33. execvp(argv[1], &argv[1]);
  34. printf("Failed to execute %s\n", argv[1]);
  35. return -1;
  36. }