V_init.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. /**
  2. * \file V_init.c
  3. *
  4. * \brief Interactive initialization functions.
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or (at
  9. * your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful, but
  12. * WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19. *
  20. * \author GRASS GIS Development Team
  21. *
  22. * \date 1999-2006
  23. */
  24. #include <grass/config.h>
  25. #include <stdlib.h>
  26. #include <grass/gis.h>
  27. #include <grass/vask.h>
  28. /**
  29. * \fn int V_init ()
  30. *
  31. * \brief Initialize curses and prepare screen.
  32. *
  33. * \return always returns 0
  34. */
  35. void V_init(void)
  36. {
  37. static int first = 1;
  38. G_clear_screen(); /* this is a kludge - xterm has problems
  39. * it shows what was on the screen after
  40. * endwin is called in V_exit()
  41. */
  42. if (first) {
  43. initscr(); /* initialize curses and tty */
  44. first = 0;
  45. }
  46. /* the order of these 3 calls is important for
  47. * Mips' braindead implementation of curses */
  48. noecho();
  49. nonl();
  50. raw();
  51. clear();
  52. refresh();
  53. #ifdef HAVE_KEYPAD
  54. keypad(stdscr, 1);
  55. #endif
  56. }