3
0

reset.c 759 B

123456789101112131415161718192021222324252627282930
  1. /* vi: set sw=4 ts=4: */
  2. /*
  3. * Mini reset implementation for busybox
  4. *
  5. * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org>
  6. * Written by Erik Andersen and Kent Robotti <robotti@metconnect.com>
  7. *
  8. * Licensed under GPLv2 or later, see file LICENSE in this tarball for details.
  9. */
  10. /* no options, no getopt */
  11. #include "libbb.h"
  12. int reset_main(int argc, char **argv);
  13. int reset_main(int argc, char **argv)
  14. {
  15. if (isatty(1)) {
  16. /* See 'man 4 console_codes' for details:
  17. * "ESC c" -- Reset
  18. * "ESC ( K" -- Select user mapping
  19. * "ESC [ J" -- Erase display
  20. * "ESC [ 0 m" -- Reset all display attributes
  21. * "ESC [ ? 25 h" -- Make cursor visible.
  22. */
  23. printf("\033c\033(K\033[J\033[0m\033[?25h");
  24. }
  25. return EXIT_SUCCESS;
  26. }