GRASS Programmer's Manual  6.4.2(2012)
V_support.c
Go to the documentation of this file.
00001 
00028 #include <grass/config.h>
00029 #include <stdio.h>
00030 #ifndef __MINGW32__
00031 #include <pwd.h>
00032 #endif
00033 #include <unistd.h>
00034 #include <sys/types.h>
00035 #include <curses.h>
00036 #include <grass/gis.h>
00037 #include <grass/vask.h>
00038 #include <grass/glocale.h>
00039 
00040 
00050 int V__dump_window(void)
00051 {
00052     int atrow, atcol;
00053     FILE *file;
00054     char home[GPATH_MAX];
00055     int curx, cury;
00056 
00057     sprintf(home, "%s/visual_ask", G_home());
00058 
00059     if ((file = fopen(home, "a")) == NULL) {
00060         V_error(_("Unable to open file %s"), home);
00061         return (-1);
00062     }
00063 
00064     getyx(stdscr, cury, curx);
00065 
00066     fprintf(file,
00067             "--------------------------------------------------------\n");
00068     for (atrow = 0; atrow < LINES; atrow++) {
00069         for (atcol = 0; atcol < COLS - 1; atcol++) {
00070             move(atrow, atcol);
00071             fprintf(file, "%c", (int)(inch() & A_CHARTEXT));
00072         }
00073         fprintf(file, "\n");
00074     }
00075     fprintf(file,
00076             "--------------------------------------------------------\n");
00077     fprintf(file, "\n\n");
00078     fclose(file);
00079 
00080     move(cury, curx);
00081     return 0;
00082 }
00083 
00084 
00095 void V__remove_trail(int ans_col, char *answer)
00096 {
00097     char *ans_ptr;
00098 
00099     ans_ptr = answer + ans_col;
00100     while (ans_col >= 0) {
00101         int c = *(unsigned char *)ans_ptr;
00102 
00103         if (c > '\040' && c != '\177' && c != '_')
00104             return;
00105 
00106         *ans_ptr = '\0';
00107         ans_col--;
00108         ans_ptr--;
00109     }
00110 
00111     return;
00112 }
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines