GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
V_support.c
Go to the documentation of this file.
1 
28 #include <grass/config.h>
29 #include <stdio.h>
30 #ifndef __MINGW32__
31 #include <pwd.h>
32 #endif
33 #include <unistd.h>
34 #include <sys/types.h>
35 #include <curses.h>
36 #include <grass/gis.h>
37 #include <grass/vask.h>
38 #include <grass/glocale.h>
39 
40 
50 int V__dump_window(void)
51 {
52  int atrow, atcol;
53  FILE *file;
54  char home[GPATH_MAX];
55  int curx, cury;
56 
57  sprintf(home, "%s/visual_ask", G_home());
58 
59  if ((file = fopen(home, "a")) == NULL) {
60  V_error(_("Unable to open file %s"), home);
61  return (-1);
62  }
63 
64  getyx(stdscr, cury, curx);
65 
66  fprintf(file,
67  "--------------------------------------------------------\n");
68  for (atrow = 0; atrow < LINES; atrow++) {
69  for (atcol = 0; atcol < COLS - 1; atcol++) {
70  move(atrow, atcol);
71  fprintf(file, "%c", (int)(inch() & A_CHARTEXT));
72  }
73  fprintf(file, "\n");
74  }
75  fprintf(file,
76  "--------------------------------------------------------\n");
77  fprintf(file, "\n\n");
78  fclose(file);
79 
80  move(cury, curx);
81  return 0;
82 }
83 
84 
95 void V__remove_trail(int ans_col, char *answer)
96 {
97  char *ans_ptr;
98 
99  ans_ptr = answer + ans_col;
100  while (ans_col >= 0) {
101  int c = *(unsigned char *)ans_ptr;
102 
103  if (c > '\040' && c != '\177' && c != '_')
104  return;
105 
106  *ans_ptr = '\0';
107  ans_col--;
108  ans_ptr--;
109  }
110 
111  return;
112 }
sprintf(buf2,"%s", G3D_CATS_ELEMENT)
void V__remove_trail(int ans_col, char *answer)
Remove trailing text from answer?
Definition: V_support.c:95
char * G_home(void)
user&#39;s home directory
Definition: home.c:32
void V_error(const char *fmt,...)
Definition: V_error.c:44
int V__dump_window(void)
Dumps screen to file.
Definition: V_support.c:50
return NULL
Definition: dbfopen.c:1394
fclose(fd)
#define file